View Single Post
  #3  
Old 08-12-2010, 02:43 AM
Philippe Philippe is offline
Member
 
Join Date: Jul 2010
Posts: 12
I am using Vizard only for two weeks, so maybe some of my questions are trivial ones. The problem we get was as follows (meanwhile, I found a workaround, but I would like to understand why it happened so that I will use the lookat in a proper way in the future):

The code we had was:

def lookAtObjectAction(obj,avatar):
v = obj.getPosition()
head = avatar.getBone('Bip01 Head')
a1 = vizact.call(head.lock)
a2 = vizact.call(head.lookat, v, 0 , viz.AVATAR_WORLD )
return vizact.sequence(a1,a2)



def bringAvatarIn(avatar) :
avatar.visible(viz.ON)

morphs = avatar.getMorphList()
talkMorph = morphs[2]
speak = vizact.parallel(vizact.speak(talkFile,scale = 0.003,morph = talkMorph),vizact.animation(3))
lookRight = lookAtObjectAction(my_cofeeMug,avatar)
waltkTo1 = vizact.walkTo([-1.2,0,2.0],WALKING_SPEED_1,0)
waltkTo2 = vizact.walkTo([0, 0, 3],WALKING_SPEED_2,180)
lookStraight = lookAtObjectAction(viz.MainView,avatar)
[exp_position_x,exp_position_z,exp_position_y] = viz.MainView.getPosition()
waltkTo3 = vizact.walkTo([-1,0,4],WALKING_SPEED_2,180) seq = vizact.sequence(lookRight,waltkTo1,lookStraight,wa ltkTo2,lookStraight, waltkTo3,lookStraight)
avatar.addAction(seq)

I do not understand why using lookStraight changes the orientation of the head (the Avatar is looking backwards, to his left), although the MainView stays at the same point all the time - only at the third time we call lookStraight in the seq, the Avatar looks straight and not backwards. Is it because of the "head.lock" ? If so, why does the head turn forwards at the third time we call lookStraight ?
__________________
Thanks,

Philippe
Reply With Quote