![]() |
|
#1
|
|||
|
|||
lookat and threads status
Hi.
We get some troubles using lookat. We originally thought that after calling lookat with some parameters, when calling to lookat with new parameters, the new position will be immediately updated. But when we used a sequence of the type: {method with lookat} {method with walkTo} {method with lookat} {method with walkTo} {method with lookat} {method with walkTo} we obtained some kind of strange behavior, where the direction of the head came later than the change in the walkTo, even though all the methods above were in one <vizact>.sequence. The head was totally distorted in a very strange manner, no matter how we chose the lookat x,y,z point. We finally succeeded to find a workaround by splitting one of the walkTo path in two, in order to have the Avatar smoothly moving its head (and not having it looking completely backwards as it happened). In other words, not the change of the lookat x,y,z made the change in the head movement, but splitting the walkTo in sub paths (it seems like the lookat was not immediately updated and was stuck in the previous x,y,z definition). This leads me to another (more general) question: when a thread (like lookat or walkTo) is launched, is there a way to know whether it is still active and what is its status ? Thanks.
__________________
Thanks, Philippe |
#2
|
|||
|
|||
Can you post an example that shows whats happening?
You can check the current action of a specific pool on a node is using <node3d>.getAction(). |
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
Sorry, forgot to post the code at the beginning of main:
#Coffee Mug my_cofeeMug = viz.add(COFFEE_MUG_PATH) my_cofeeMug.setPosition( -2.2 , 0.85 , 1 ) my_cofeeMug.setScale( .01, .01, .01) ... seems like it continues to look at the my_cofeeMug object - Is it locked at the my_cofeeMug object? If so, why does the head turn forwards at the third time we call lookStraight ?
__________________
Thanks, Philippe |
![]() |
|
|