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.
Please help.

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 *
loadPrcFileData('','window-title Circle of Smileys')
import direct.directbase.DirectStart
from direct.interval.IntervalGlobal import *
from direct.task import Task


def lookAtFrowney(np):
   np.lookAt(frowney)
   return Task.cont

def followFrowneyDirection(np):
   np.setH(frowney,0)
   return Task.cont

frowney=loader.loadModel('frowney')
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=loader.loadModel('smiley')
    smi.reparentTo(dummy)
    smi.setScale(.6)
    smi.setX(5)
    nose=loader.loadModel('misc/Dirlight')
    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)
       taskMgr.add(lookAtFrowney,'lookAtFrowney',extraArgs=[smi])
    else:
       nose.setH(180)
       nose.setY(.7)
       taskMgr.add(followFrowneyDirection,'followFrowneyDirection',extraArgs=[smi])
    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!
It is very helpful.