constrain rotation with the game engine api

I’ve been searching for ways to constrain the rotation of an object, but I’ve run into a few problems (this is also my first time venturing into scripting in the game engine):

  • I can’t use an ipo based method because the object tracks to the mouse using a script

  • the object behaves exactly as I want when I switch off the “3d” button in the trackTo actuator, but I need this behaviour in the y-z plane instead of the x-y plane

  • I can’t parent an empty to the object and do collision detection on the empty, since the nature of the constraint is not max/min, but more like an axle (I want to prevent rotation on one axis completely)

  • I’ve tried using the setOrientation() function in the api, but I’d really rather not reset the rotation matrix on every frame, since this seems like a waste of resources

  • There used to be a handy rotation constraint actuator in the 2.34 api, but it has disappeared as far as I can tell

Does anyone know why the rotation constraint has been removed, and is there any other means of doing what I want?

thanks for any tips

Did you read this thread:
http://blenderartists.org/forum/showthread.php?p=1010175#post1010175

Its just a couple down from yours. Follow the link to the wiki. And in the actuators its called constraint, I think.

yeah, I read through that thread, but I thought that they decided to use an ipo based technique in the end.

The link to the wiki goes to a page about object constraints. This might work for animations and such, but it doesn’t appear to do anything in the game engine.

There is a constraints actuator in the game engine, but it only handles loc, and not rot.

if you look at the 2.34 documentation, it does seem to support rotation, but the 2.45 documentation no longer has the rotation parameters

http://www.blender.org/documentation/pydoc_gameengine/PyDoc-Gameengine-2.34/KX_ConstraintActuator.KX_ConstraintActuator-class.html#setLimit

hmmm, very interesting…so in the object buttons, the constraint dont work in the game engine? I really dont know, never used them, except for tracking.

I am looking into it through another direction, but for some reason, I dont seem to download any blender sites. Meaning it takes like 10 or 15 minutes or just plain none at all…arrrrrrrggggggg.

I need to check my connections…

from playing with the object constraints, I’ve only managed to make the rigid body constraints work. Tracking and other stuff works for animation, but doesn’t do anything in the game engine.

I don’t know either… maybe there’s some other pre-requisite for them to function.

I tried using the hinge rigid body constraint, but it doesn’t seem to play well with a track-to actuator.

for now I’ve settled on a non-technical solution (the character only rotates when you click, instead of all the time). It works well enough, but a solution to this might be nice.

thanks for the help

Please explain the reason why you think that you cannot use an IPO curve, and I will more than likely explain to you how you can.

the object in question has a track-to actuator, which makes it point to the position of the mouse.

I suppose I could make it keyboard controlled, but I think that would take away from the experience