#1
|
|||
|
|||
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. Code:
drone = viz.addChild('Drone.FBX') drone.state(1) --Frank |
#2
|
|||
|
|||
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?
Code:
#set to loop drone.setAnimationLoopMode(1) #toggle between pause/play vizact.onkeydown(' ',drone.setAnimationState,viz.TOGGLE) |
#3
|
|||
|
|||
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?
Thanks, --Frank |
#4
|
|||
|
|||
Try getting a handle to the animation as a child object and apply the commands to that:
Code:
animation = drone.getChild('Take 001') |
#5
|
|||
|
|||
I tried the following:
Code:
animation = drone.getChild('Take 001') animation.setAnimationLoopMode(1) vizact.onkeydown(' ',animation.setAnimationState,viz.TOGGLE) Code:
animation = drone.getChild('Take 001') animation.setAnimationLoopMode(1) vizact.onkeydown(' ',drone.setAnimationState,viz.TOGGLE) 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 --Frank |
#6
|
|||
|
|||
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.
|
#7
|
|||
|
|||
Would it be possible to get a sample FBX model that shows this? If so, contact support@worldviz.com and I'll follow up with a developer.
|
#8
|
|||
|
|||
I've sent an email with the attached fbx file in question. THANKS!
|
#9
|
|||
|
|||
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.
So: 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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Get head of the avatar models alone | carlosppamaral | Vizard | 3 | 03-23-2014 04:05 PM |
Two animations performed by avatar at the same time | michelcm3 | Vizard | 1 | 09-21-2007 10:51 AM |
avatar animations | vduckie | Vizard | 12 | 02-27-2006 02:32 PM |
Pausing and stepping through avatar animations | Vbents | Vizard | 3 | 11-03-2005 10:14 AM |
More on avatar animations | vjonshih | Vizard | 3 | 09-20-2004 05:37 PM |