Constraining the Rotation of a game object

Hi,

This may seem like a simple problem (maybe it is), but I can’t find a solution to it in the current blender 2.49 game engine.

I want to implement a rotational constraint on an object, so that it will only rotate around the (local) Z-axis, and I want to accomplish this with the logic brick system - not with python script.

The current game engine logic actuators cover; TrackTo, Location, Distance, Orientation and ForceField.

example:

Object A tracks to object B

Therefore object A will focus on object B always.

But, Object A only rotates in the local Z-Axis.

Cheers,

Journeyman.

So… you want to have the ‘up’ of the object always be ‘up’?

I know you said no python, but it’s a short script…

GameLogic.getCurrentController().owner.alignAxisToVect([0,0,1],2,1)

Always(Pulse on) -> Python(one-line-script-name)

done!

I dont understand your meaning really but did you checkout the fairly recently added Orientation constraint?- Select the Constraint actuator, then “Orientation”, you can select min/max limits and what to Orient to.

The constraint actuator?

Hi ideasman42,

I’m working with Blender 2.49a / Python 2.6… I’ve tried the Constraint Actuator in Orientation type but in Game Mode it does nothing. I have to be missing something, but don’t know what. I don’t understand why the minimum angle possible is 0 and the max 180. I’m also lost with the “XYZ component of reference direction” which values go from -2000 to 2000.

Maybe I’m just using the wrong approach to limit the rotation of an object in game mode. Could you please explain the use of this actuator? A simple .blend example will be greatly appreciated.

Apollo

PS: I would be interested in knowing how to limit the rotation in python code as well.

Bump for clarification.

I believe you can use Rigid Body Constraint, Hinge joints in the Object panel. The GE follows that constraint, so you can rotate the hinge to allow it to only rotate on the (whatever) axis.

I don’t know if you can combine that with Track To and have it work properly, but it’s worth a shot.