PDA

View Full Version : Avatar Duck Animations


Amit
10-13-2005, 09:10 AM
I want to translate a duck (an inbuilt avatar) from one position (say A) to another position(say B). At position A, the duck should not have any movements, that is, it is stationary (code: duck.state(0)). when pressing left click, it should move towards position B, but with state(1).
{code:
duckMove=vizact.sequence(vizact.goto(x,y,z))
duck.add(duckMove)
duck.state(1)
}

once we reach position B, the duck should stop moving and should be in state(0).

{code:
def actionEnd(obj,action):
if action==duckMove:
duck.state(0)

viz.callback(viz.ACTION_END_EVENT,actionEnd)
}

but this doesn't seem to work, can you please suggest something, by which I can carry out the specified task.

-Amit

farshizzo
10-13-2005, 10:03 AM
Hi,

Avatar animation numbers start at 1, so an animation of 0 is invalid. Try clearing the animation instead by using the following command:duck.clear(1) #Stop performing animation 1Also, when you add the duck, set its idle pose to -1, since it doesn't have one:duck.idlepose(-1)

Amit
10-13-2005, 12:45 PM
Great, it worked!!! Thanks!!!

some points to ponder upon:

When I used the code: duck.state(0), it worked as the duck won't move when the duck is first added.

If state(0) is invalid then why won't the program return an error remark?

also to keep in mind, when the duck is first added, it wouldn't be idle, but be in the 'ik.CAF' state.

so putting duck.state(0) the duck goes into the idle mode. if it works once then why won't it work again in the action end callback function?


sorry to ask so many questions, but I am just curious. :)

-Amit

farshizzo
10-13-2005, 12:59 PM
Hi,

When an avatar is first added, all its animations are cleared, so performing duck.state(0) does nothing. The idlepose mostly exists for backwards compatibility. It is started when an action is finished being performed on pool 0 of an avatar. We will try to add more descriptive error messages for future version of Vizard.

Also, feel free to ask as many questions as you want. That's what I'm here for. :)