WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-10-2015, 04:58 PM
wildcat wildcat is offline
Member
 
Join Date: Nov 2015
Posts: 4
Question 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)
Thanks for any advice!
--Frank
Reply With Quote
  #2  
Old 11-10-2015, 05:17 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
Reply With Quote
  #3  
Old 11-10-2015, 05:44 PM
wildcat wildcat is offline
Member
 
Join Date: Nov 2015
Posts: 4
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
Reply With Quote
  #4  
Old 11-10-2015, 05:50 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Try getting a handle to the animation as a child object and apply the commands to that:

Code:
animation = drone.getChild('Take 001')
Does this work for you?
Reply With Quote
  #5  
Old 11-10-2015, 06:33 PM
wildcat wildcat is offline
Member
 
Join Date: Nov 2015
Posts: 4
I tried the following:

Code:
animation = drone.getChild('Take 001')
animation.setAnimationLoopMode(1)
vizact.onkeydown(' ',animation.setAnimationState,viz.TOGGLE)
and also, for good measure:

Code:
animation = drone.getChild('Take 001')
animation.setAnimationLoopMode(1)
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
--Frank
Reply With Quote
  #6  
Old 11-16-2015, 03:06 PM
craigpet craigpet is offline
Member
 
Join Date: Aug 2015
Posts: 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.
Reply With Quote
  #7  
Old 11-16-2015, 05:47 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #8  
Old 11-23-2015, 06:26 PM
wildcat wildcat is offline
Member
 
Join Date: Nov 2015
Posts: 4
I've sent an email with the attached fbx file in question. THANKS!
Reply With Quote
  #9  
Old 07-03-2020, 04:57 AM
Gusgus Gusgus is offline
Registered User
 
Join Date: May 2019
Posts: 1
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 08:14 AM.


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