Poly rotation? *solved*

Official forum for the Chipmunk2D Physics Library.
Post Reply
drpants
Posts: 1
Joined: Sun Jul 05, 2009 1:00 pm
Contact:

Poly rotation? *solved*

Post by drpants »

Hello,

Pardon my lack of understanding, but I'm having trouble understanding polygon rotation. I have created a body using cpBodyNew(), and created and attached a polygon to the body using cpPolyShapeNew(). I have also created a static body and segment to represent a floor, which is slanted. When the poly collides with the floor, it bounces and begins to slide down the face, however its vertexes show no rotation.

I am drawing the poly based on the location of its body and the vertexes returned from cpPolyShapeGetVert(). What am I missing here - do I need to do some body -> world coordinate conversion or something?

Thanks Kindly,

Dr. Pants

Okay, found my problem - I needed to rotate each vertex of the poly by calling cpvrotate(polyvertex, body->rot). Just thought I'd mention it in case it might help someone else.. Also, thanks for this wonderful library, Slembcke!
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests