does Chimpunk physics using flipped X rotation?

Official forum for the Chipmunk2D Physics Library.
Post Reply
Vovchik
Posts: 2
Joined: Mon Sep 24, 2012 1:10 pm
Contact:

does Chimpunk physics using flipped X rotation?

Post by Vovchik »

I'm working on Go-Chimpunk library https://github.com/vova616/chipmunk
And also on a game engine, but when I'm passing position to physic engine I always need to do the following
body.SetAngle(180-p.GameObject().Transform().WorldRotation().Z)
is the chipmunk physics flipped?
I also looked on the demo application and when I use angle of 75 the box is flipped as well
that picture demonstrate my question

Image

I calculate my matrix like this

mat.Scale(s.X, s.Y, s.Z)
mat.Rotate(r.X, 1, 0, 0)
mat.Rotate(r.Y, 0, 1, 0)
mat.Rotate(r.Z, 0, 0, 1)
mat.Translate(p.X, p.Y, p.Z)

camera view matrix the same but with Invert after the Translate

so is it problem with my engine or chipmunk uses flipped rotation?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: does Chimpunk physics using flipped X rotation?

Post by slembcke »

Chipmunk angles are always in radians and always measured in a counterclockwise direction like in trigonometry and most other math. The direction of rotation also depends on if your y-axis is up or down. Again, I went with the traditional route and the y-axis points up.

There isn't really a correct direction, so I chose what I was more comfortable with.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Vovchik
Posts: 2
Joined: Mon Sep 24, 2012 1:10 pm
Contact:

Re: does Chimpunk physics using flipped X rotation?

Post by Vovchik »

my y-axis is up..
so what are you suggesting?
how is it possible to change that in the chipmunk library?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: does Chimpunk physics using flipped X rotation?

Post by slembcke »

It's not possible to change it. You just need to be aware of it when you interpret the angles. If it goes the wrong way, multiply it by -1. If you need it to be in degrees, multiply it by 180/pi.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests