calculate box2d impulse for a certain angle of impact

我怕爱的太早我们不能终老 提交于 2019-12-01 13:15:56

I don't read objective-C, but the problem seems to be clear:

Your impulse b2Vec2(0, [self fullMass]*[GameMaster sharedInstance].usrTrampolineForce) does not actually include any x component!

Split your impulse into x and y components (pseudocode):

Impulse_magnitude = Ball_mass * Trampoline_Force
# theta is the angle between the horizontal and your impulse
# this will depend on the angle of the trampoline.
Impulse_x = Impulse_magnitude * Cos(theta)
Impulse_y = Impulse_magnitude * Sin(theta)
# Create your impulse vector
Impulse_v = b2Vec(Impulse_x, Impulse_y)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!