Disabling gravity in Matter.js

a 夏天 提交于 2019-12-05 11:31:21

问题


Is there any way to disable gravity in Matter.js? I want my objects (bodies) to keep their physical abilities (like reaction to collision, restitution, friction etc), but I'd like to prevent the reaction to device's gyro and orientation change.


回答1:


Try

engine.world.gravity.y = 0;

where engine is your engine instance.



来源:https://stackoverflow.com/questions/29466684/disabling-gravity-in-matter-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!