-
What's the idiomatic way of rotating a body with Chipmunk? I'm doing something like this: shape.Body().SetAngle(0.78)
shape.Body().SetVelocity(0, 50) But the body still moves perfectly vertically. I realize that I can probably calculate the vector of the velocity to achieve a specific angle, but I'm wondering what's Some examples would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think this is not a question about Ebitengine. Please ask the author of the Chipmunk repository. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Figured it out! The solution was to rotate the velocity vector after setting the angle: shape.Body().SetVelocity(0, 50)
angle := shape.Body().Angle()
inc = 0.05
shape.Body().SetAngle(angle + inc)
velocity := p.shape.Body().Velocity()
other := cp.ForAngle(inc)
shape.Body().SetVelocityVector(velocity.Rotate(other)) |
Beta Was this translation helpful? Give feedback.
Figured it out! The solution was to rotate the velocity vector after setting the angle: