stop y rotation

I am trying to make so that a dynamic object dose not rotate on the y axis…

This did not seem to help:

cont = GameLogic.getCurrentController()
own = cont.getOwner()

please help… gasp!

It might be best to just reset the y every time. If you don’t want to use python, vertex parent an object in the y direction and use a trackto actuator. It’s really easier, otherwise you’ll have to use orientation and it gets a little complex.
When you see all capital letters like that it means your dealing with a constant. It’s just a number that doesn’t change. So you use those in a function. Your not doing that, your just sort of acknowledging it. I’ll check it out a little more and get back.(maybe), or someone else might have more experience in setting constraints using python. Remember a trackto actuator only needs to be triggered once, so don’t put an always sensor on it unless the pulses are turned off.


i gotta try that!
the trackto would be much easyer for me :slight_smile:

Thanks Fireside,

Thanks for the tip about TrackTo. I wasn’t aware it worked like that.

Please, always try to explain what you are actually doing in your game, and what the basic problem is.

Usually people with less experience try to implement a complex python solution to what is essentialy solvable with some parent/logic brick shuffle, or a small physics values tweak.

I’m not saying that you shouldn’t look for solutions on your own, but when you ask for help, don’t ask for help with the solution that you are currently trying to implement, ask for help with the actual problem.

The code that you have set there looks very wrong. The KX constant that you are trying to implement is supposed to be set using the “setLimit()” function, which resides with the constraint actuator itself:

cont.own??? Where are you getting your code from?

thanks for your reply Social :slight_smile:

Please, always try to explain what you are actually doing in your game, and what the basic problem is.

yea! sure…

I am trying to make a nice 2d platform game. I don’t want my player, and other physics objects to be able to roll/rotate/spin/ or twirl, on the Y or X axis.

Come to think of it, there are quite a few instances where i don’t want a dynamic object to be able to rotate. Even if I am approaching the above wrong, I would still like to know how to constrain a rotation. (If it is even possible , hopefully this is not too complex.)

thanks again…
I am going to try a fireside’ s approach , I don’t think I have ever vertex parent-ed anything before, this will be good to learn :slight_smile:


the vertex parent thing totaly did the trick!

here is the tutorial I foolowed to learn how to vertex parent something:,_Rod_and_Crank

I’m making a 2-D platformer as well (as some know, given my previous questions), and have encountered a similar problem as pOOf. My bullets need to be dynamic in order to interact with a wall, but I still want them to fly strait, instead of dropping. Basically, I want them to not be able to move on the Z axis. I’ve tried a contraint actuator, but what that does is make it so it can’t move along the X either. I’ve played with the settings a lot and can’t get it to work. It’ll be interesting for me to learn the solutionto pOOf’s problem as well.


add a Always>and>motion +9.8 Force on the global Z of the bullett
that will make so that gravity will not effect the bullett
the +9.8 will neutrailize the constant -9.8 gravity simulation

here is a better solution…
when you edit>add the bullett to the scene, dont add a velocity or a time…
Rather, have an always>and>motion +10 lin V off the local Z of teh bullett…
and a timmer that kills the bullett when it hits nothing… (with a neat effect, rather than just dissapearing )