Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

turn gravity off on one object matter js

Events.on(engine, 'beforeUpdate', function() {
    var gravity = engine.world.gravity;

    if (noGravity) {
        Body.applyForce(body, body.position, {
            x: -gravity.x * gravity.scale * body.mass,
            y: -gravity.y * gravity.scale * body.mass
        });
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #turn #gravity #object #matter #js
ADD COMMENT
Topic
Name
8+6 =