# Actor Position

How can we determine the the direction in which the actor is looking?
e.g in Roaming Ralph example Ralph is moving in certain direction
When we press the Up arrow key the Y of the Actor Image is modified.

When we press the Right arrow key the actor looks towards right direction.In this case what coordinate(of actor) is modified?
Is it that Ralph.SetH() does this.

Let me put it in a better way:

How can we determine the direction in which the actor is looking?

I am developing an application where I want one of my actors to look/turn to same direction where
some other specific actor is Facing/Standing.

If you want to set other node’s heading exactly the same as the other, set it this way :

``nodepath.setH(otherNode,0)``

Try this : (I hope the comment is enough)

``````from pandac.PandaModules import *
import direct.directbase.DirectStart
from direct.interval.IntervalGlobal import *

def lookAtFrowney(np):
np.lookAt(frowney)

def followFrowneyDirection(np):
np.setH(frowney,0)

frowney.reparentTo(render)
frowney.setH(-90)
Sequence(
frowney.posInterval(2,Point3(-8,0,0),Point3(8,0,0),blendType='easeInOut'),
frowney.hprInterval(.5,Vec3(90,0,0)),
frowney.posInterval(2,Point3(8,0,0),blendType='easeInOut'),
frowney.hprInterval(.5,Vec3(-90,0,0)),
).loop()

lookingAtFrowney=1 # toggle looking at frowney or following it's direction

dummy=render.attachNewNode('')
num=10
for i in range(num):
smi.reparentTo(dummy)
smi.setScale(.6)
smi.setX(5)
nose.reparentTo(smi)
nose.setScale(.5,.35,.5)
if lookingAtFrowney:
smi.find('**/+GeomNode').setH(180) # NodePath.lookAt uses Y+ as forward direction,
# so flip smiley's geomnode to face Y+
nose.setY(-.7)
else:
nose.setH(180)
nose.setY(.7)
dummy.setH((i+.5)*360/num)
smi.wrtReparentTo(render)

camera.setPos(-20, -15, 9)
camera.lookAt(render)
mat=Mat4(camera.getMat())
mat.invertInPlace()
base.mouseInterfaceNode.setMat(mat)
base.setBackgroundColor(0,0,0,1)
run()``````

Thanks a ton!