Poly rotation? *solved*
Posted: Sun Jul 05, 2009 1:15 pm
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!
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!