开发者

How to restrict motion to vertical in box2d

开发者 https://www.devze.com 2023-04-07 19:23 出处:网络
I have a box2d body that has a fixture of a ball. It just bounces up and down on top of a rectangular box. Sometimes it will fall off of the box for n开发者_如何学Pythono apparent reason. I there a wa

I have a box2d body that has a fixture of a ball. It just bounces up and down on top of a rectangular box. Sometimes it will fall off of the box for n开发者_如何学Pythono apparent reason. I there a way to restrict gravity to only vertical so that I can solve this problem?


Or you could use a prismatic joint. Check out this video.


Use b2LineJoint to allow your body to move in one direction only

0

精彩评论

暂无评论...
验证码 换一张
取 消