Skip to content

Rotating a body using the Chipmunk library #2789

Answered by musjj
musjj asked this question in Q&A
Discussion options

You must be logged in to vote

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))

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@musjj
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by musjj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants