Skip to content

Instantly share code, notes, and snippets.

@garganurag893
Created November 16, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garganurag893/4a6cfb1b885b803a312ee0ffff24c16a to your computer and use it in GitHub Desktop.
Save garganurag893/4a6cfb1b885b803a312ee0ffff24c16a to your computer and use it in GitHub Desktop.
import Matter from 'matter-js';
const UpdatePlane = (entities, {touches, time}) => {
const engine = entities.physics.engine;
touches
.filter(t => t.type === 'press')
.forEach(t => {
Matter.Body.setVelocity(entities.Plane.body, {
x: entities.Plane.body.velocity.x,
y: -3,
});
});
Matter.Engine.update(engine, time.delta);
return entities;
};
export default UpdatePlane;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment