Local constraint?

How can i make a Local Constraint in Game Engine?

I have a camera tracking to an empty and wich that the camera do not go to near or to far from the empty. With a Local Z constraint, it solve my problem.

How can i do this?

Thank you very much!

Have you tried the camera actuator if that dont do it for you then try python :wink:


import GameLogic as g
c = g.getCurrentController()
o = c.getOwner()

pos = o.getPosition()
if pos[2] < 10:
    o.setPosition(pos[0], pos[1],10)
elif pos[2] > 20:
    o.setPosition(pos[0], pos[1],20)

should work :smiley:

Don’t work.

setPosition() sets global coords instead of locals.