# rotation axe constraint

I was looking for the rotation contraint but I could only find the locx , y ,z constraint… its for a racing game and I kinda need it… if I put rigid body on the character can flip upsidedown and its a big no… and if I desable rigid body it is constrained completely on the y and X rotation axis… what I kinda want is thie:

From what I’ve read (haven’t tried it yet) the only way to constrain rotation in the BGE is to assign an IPO curve with keys on the axis you want to constrain to the object.

More complicated than the “just choose constrain y axis” answer I wanted at the time, which is why I never got around to trying it. Just search for constrain rotation IPO curve and I’m sure you’ll find a more practical howto though.

You might be able to use getOrientation in Python, and then give it some negative torque when it exceeds 45 degrees on those axes. I’ve never tried doing this, though. There are a lot of ways that people have “constrained” the movement on a mouse-look script. Maybe one of those could help you.

you could definitely use get orientation and set orientation… but it would still slide around on the surfaces because of gravity?

cough get and set orientation doesnt work with degrees…
edit: actually is there a way or a method on how I can convert the matrix of the orientation into degrees?

cough I never said they did work with degrees… You don’t specifically need degrees…

all you need is to match the orientation of your object with that of your ramp… just make them equal when car object collides with the different angled surface… ie. on collision get orientation of ramp… then car orientation = orientation of ramp… or don’t do that at all…if you don’t want the car to flip… just put a lot of down force on it… till it won’t flip over… maybe change the down force to be stronger for ramps you know will flip the car… experiment until it works…

–there are lots of ways to do it with out needing degrees or radians or knowledge of matrices…