Constraint actuator, orientation mode: What do the parameters do?

I’m trying to figure out how the constraint actuator works. At the moment, I’m trying to work with the orientation mode of the constraint actuator. The goal is: While a key is pressed, rotate an object along it’s z axis, until a max angle is reached.

CYNIC78 posted a blend file of how to make the constraint actuator do what I want, but I don’t understand how it works. https://blenderartists.org/forum/showthread.php?444009-Noob-Stick-with-logic-bricks-for-now-or-go-to-python-upbge&p=3275885&viewfull=1#post3275885

So what we have there is a keyboard sensor waiting for an ‘a’ key, which sends a signal to both a motion actuator (set for 1 degree rotation on the z axis) and a constraint actuator, which is in orientation mode. The ‘direction’ of the constraint actuator is set for ‘y axis’. Why is that? And the ‘reference direction’ is set for a small value of ‘y’. It seems that any value of y works the same.

The blender manual says that ‘direction’ is the axis to be modified. https://docs.blender.org/manual/en/dev/game_engine/logic/actuators/types/constraint.html

What does that mean? I don’t want to modify any axis. I want to set a limit of rotation for the z axis.

The blender manual says that ‘reference direction’ is the reference direction for the specified game axis. https://docs.blender.org/manual/en/dev/game_engine/logic/actuators/types/constraint.html

Again, I don’t know what that means. Why is a reference direction needed here and what does it have to do with setting a limit of rotation?

I abandoned ship on the constraint actuator. I think it is intended for something other than the purpose I was trying to use it for.

But I did arrive at a solution for setting rotation limits by adding a property to my object and checking it’s value as a condition for rotation. In a nutshell, if the property, rotation-sum, is greater than -45 degrees AND the A key is pressed, then rotate by -1 degree on the z axis, or if the property, rotation-sum, is less than 45 degrees AND the D key is pressed, then rotate by 1 degree on the z axis. Here is the blender file: rotation-limits.blend (475 KB)

I think I will post a broader tutorial on basic object movement using only logic bricks after I have more figured out, both for helping other noobs such as myself and as a means for better understanding what I learn and figure out.

Thanks to everyone who goes to the effort of sharing information and taking the time to make tutorials for other Blender users.

This seems like a less clunky way for limiting rotation, using expression controllers rather than property sensors.

rotation-limits-expression.blend (463 KB)

Good job. I found your solution is very elegant. Congratilations! :slight_smile:

I create a skinned human rag doll for my GAME but can’t spawn with logic bricks cause lost Copy Location and Copy Rotation constrains of all bones of armature

there have 15 rigid bodies objects and 15 bones in armature.

Can anybody give example of just set one bone constrain here for i repeat to my human rag doll?

import bge
import constrains

rigidbody1 = scene.objects[‘head’]
.



rigidbody15 = scene.objects[‘hand_left’]

armature = scene.objects[‘armature’]

target_object = rigidbody1
sel_bone = armature.pose.bones[“head”]

And now I need to add a bone constraint for selected_bone to copy rotation and copy location of target_object. Does python API have such method?

please look my video of ragdoll skinned the front is original ragdoll and back is instanced group not work.i just need spawn this simple model.logic bricks lost constrains with group and instance group not work.

If possible help me

using expression is great indeed, but in this case you should remove the first part.
this is enough: rotation <= 44. you don’t need to check if the key itself is positive, because it already checks that on it’s own.

@linuxfree
Don’t hijack other persons threads please, that is not a kind thing to do.
try https://www.youtube.com/watch?v=GaZAI8RIq0Q

Thanks. I have alot of these little problems to work out before being able to do more interesting things (by combining the little things). Little by little…

Looks like I made a noob mistake there. Thanks for the clarification.