Damped track

I need the same kind of behaviour as damped track from the object constraints, currently I found only the normal tracking option using the edit object brick. The idea is that lets say a cylinder is always pointing to something above it but when I move the tracking object around the cylinder doesn’t rotate on the Z axis.

have you trying with -> actuator edit object -> trackTo >2D< ?

if not work correctly select the cilindre, check in -> property -> relation extras -> tracking axis
and change the axis , should work, otherwise post a blend

PS: maybe you want somethin as a cannon (that turn on X and Z but not Y) .
if is the case i not know if exist a solution with brick (is not even so good with python)

Yes, basically I want it to turn in X and Y axis but not in Z. Disabling 3D option only allows rotation in one axis. In the end I need to have a field of wheat (planes with texture) and when I click somewhere I need to have the wheat rotate away from the cursor.

i can only give a code solution, and you can even use trackto since
the axis must be before aligned then “adjusted”

diffferently from the actuator you have to add the pulse mode on True ‘’’… (for example : sensor mouse left True -> script)
on the sensor that trigger the controller.
then you have to know the name of the object to track :
“”"


#####
#with this you can set the limit on other axis if need
def clamp(val,min,max):
    if val&lt;min:return min
    if val&gt;max:return max
    return val




import bge


cont = bge.logic.getCurrentController()
own = cont.owner # the obj that run this script
target = own.scene.objects["Target"] # the name must be written exactly 
vec = own.getVectTo(target)[1]
factor = 0.1
axisToAlign = 1 # +Y
own.alignAxisToVect(vec, axisToAlign, factor) # now the obj should be aligned, but can have the axis Z turned
x, y, z = own.worldOrientation.to_euler() # get the rotation in radians (not much different from the degrees)
x = clamp(x,-1,1)
y = clamp(y,-1,1)
z = 0.0 #reset the rotation just on the Z axis
own.worldOrientation = x, y, z #set the rotation with the Z axis cleaned



i hope that help

EDIT:
i wrong ome line
change
axisToAlign = 1 # +Y

with this

axisToAlign = 2 # +Z

should work

This works perfectly, exactly as needed, THANK YOU! I owe you one :slight_smile: