WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Using Animations in Non-Avatar Models (

wildcat 11-10-2015 03:58 PM

Using Animations in Non-Avatar Models
I have a .FBX file of a drone with propellers that are rigged for animation. When I use the Vizard Inspector on the file I can find the animation for making the propellers spin (it has the name 'Take 001', and is the only animation). Inside the Inspector I can also watch the animation proceed. How would I go about telling Vizard to run the animation?

I tried the following, but it doesn't work because the drone model is not an avatar file.


drone = viz.addChild('Drone.FBX')

Thanks for any advice!

Jeff 11-10-2015 04:17 PM

I've not tried this with FBX models, but animations built into OSG models can be controlled with the following commands. Does this work for you?


#set to loop
#toggle between pause/play
vizact.onkeydown(' ',drone.setAnimationState,viz.TOGGLE)

wildcat 11-10-2015 04:44 PM

Hi Jeff. The commands did not activate the animation. In looking at the code you suggested, I didn't see anything that indicates which animation to run. Was I supposed to include other code?


Jeff 11-10-2015 04:50 PM

Try getting a handle to the animation as a child object and apply the commands to that:


animation = drone.getChild('Take 001')
Does this work for you?

wildcat 11-10-2015 05:33 PM

I tried the following:


animation = drone.getChild('Take 001')
vizact.onkeydown(' ',animation.setAnimationState,viz.TOGGLE)

and also, for good measure:


animation = drone.getChild('Take 001')
vizact.onkeydown(' ',drone.setAnimationState,viz.TOGGLE)

and unfortunately neither started the propellers spinning.

Don't know if this is relevant to the problem at hand, but just in case, here is an observation. The drone model has four propellers. I get no error messages, but I do get the following informational messages in the Interactive Window when I press the spacebar:

LinkVisitor links 3 for "Drone_propeller1"
LinkVisitor links 3 for "Drone_propeller2"
LinkVisitor links 3 for "Drone_propeller3"
LinkVisitor links 3 for "Drone_propeller4"

Thanks for your help

craigpet 11-16-2015 02:06 PM

I'm having the same issue (works in inspector, can't get it to work in Vizard), though I got an error saying that there was no child of my .fbx with the name of the animation, and when I printed out redSnake.getChildren(), with redSnake as my analogue to drone, I don't see the animations in the output.

Jeff 11-16-2015 04:47 PM

Would it be possible to get a sample FBX model that shows this? If so, contact and I'll follow up with a developer.

wildcat 11-23-2015 05:26 PM

I've sent an email with the attached fbx file in question. THANKS!

Gusgus 07-03-2020 03:57 AM

For me I changed it to .osgb format and from there I found the node in the inspector that has the corresponding animation (that had the name "Drawer_5") and then grabbed that node with the <3dmodel>.getChild() method and set the state to 1. You can see all of the states, that is animations, in the inspector for the corresponding node. For example for this node there were two states ("0 - [none]" and "1 - Take 001") which are indexed for you (0,1,2 etc.) in the inspector. Maybe this is not what you are looking for but I didn't find anything about this in the Vizard documentation.
drawer = vizfx.addChild("drawer.osgb")#Load a drawer 3D model to the scene
animation = drawer.getChild('Drawer_5')#grab the node that has the animations
animation.state(1)#set it to whatever animation that is within that node

All times are GMT -7. The time now is 12:38 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC