Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在 Matter.js 中禁用重力?我希望我的对象(身体)保持其物理能力(如对碰撞、恢复、摩擦等的反应),但我想防止对设备的陀螺仪和方向变化的反应。
尝试
engine.world.gravity.y = 0;
engine你的引擎实例在哪里。
engine
您只需要将其添加到您的配置中:
physics: { default: "matter", matter: { **gravity: {x: 0, y: 0},** } }