使用 Box2D 减少反射角度
各位,
我正在尝试对球以一定角度撞击墙壁的碰撞实现某种行为。我希望球保持全速,但我希望反射角度稍微减弱,以便它从来时的方向反弹得更少。
我尝试过摩擦、阻尼和恢复,但似乎没有什么对我的回弹角度产生影响。
有谁知道我可以让 box2d 做我想要它做的事情吗?
球反射角
https://i.sstatic.net/lMwLN.png
感谢您的帮助! 肯
Folks,
I'm trying to implement a certain behavior to a collision where a ball hits a wall at an angle. I want the ball to maintain full velocity, but I would like for the angle of reflection to be somewhat muted, so that it bounces back less from the direction it came.
I've played around with friction, damping, and restitution, but nothing seems to make a difference in my return bounce angle.
Does anyone know of a way I can get box2d to do what I'm wanting it to do?
Ball angle of reflection
https://i.sstatic.net/lMwLN.png
Thanks for the help,!
ken
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您可以在您的世界中设置一个接触监听器,然后找出球与墙壁之间的确切碰撞。
其次,找出碰撞点。
最后,计算碰撞点与身体中心之间的角度。
比如
我希望你能明白我的意思
Firstly,you can set a contactListener in your world, and then ,find out the exactly collision between the ball and the wall.
Secondly,find out the collision point.
Last, calculate the angle between collision point and body center.
such as
I hope you can understand what I mean