Track to on a single axis

I know that the ‘track to’ actuator can work horizontally when 3D tracking is unticked but I want it to track only vertically, is there a way for doing that or at least lock the other axis ?

Hey, this should be in Game Engine Support and Discussion. However, you can use alignAxisToVect http://www.tutorialsforblender3d.com/GameModule/ClassKX_GameObject_1.html

make one extra object that uses 3D trackto and apply copy rotation of X axis


import bge
from mathutils import Vector
cont = bge.logic.getCurrentController()

own =cont.owner
if 'target' not in own:
   own['target']=bge.logic.getCurrentScene().objects['NameOfTarget']
   
own.alignAxisToVect(own['target'].worldPosition-own.worldPosition,0,.5) ## point X axis at target
own.alignAxisToVect(Vector([0,0,1]),2,.1) #point Z axis up

##own.alignAxisToVect(own.parent.worldOrientation.col[2],2,.1)  ##alternate, use parent Z as up axis

Sorry didn’t pay attention I wasn’t in Support page, however thx for the answers, will try em all !