📜  关闭一个物体的重力js - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:50.248000             🧑  作者: Mango

代码示例1
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
        });
    }
});