WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-16-2015, 11:13 AM
vserchi vserchi is offline
Member
 
Join Date: Sep 2013
Posts: 7
update sequence animation speed

Hi, I am trying to interactively update the speed of certain objects animations (sequences of animation) in my virtual reality. At the change of the variable "speed" I need that the speed of translation of my objects accordingly changes too. In the following code there is a a very simplified example of what I am trying to do.

Code:
import viz
import vizact

viz.fov(60)
viz.go()

#Add the ground plane
ground = viz.addChild('ground.osgb')

#Move the viewpoint back
viz.MainView.move([0,0,-7])

ball = viz.add('beachball.osgb')
ball.setPosition(0,1,0)

ball1 = viz.add('beachball.osgb')
ball1.setPosition(0,0,0)

myAction1 = vizact.moveTo([ball.getPosition()[0], -1,  ball.getPosition()[1]],speed=1) # Definition of the animation of the road (custom function that manages its resume defined from line 364 to line 439
myAction2 = vizact.moveTo([ball.getPosition()[0], ball.getPosition()[1], ball.getPosition()[2]],[ball.getPosition()[0], 4, ball.getPosition()[1]],speed=1)
myAnimation = vizact.sequence(myAction1, myAction2, viz.FOREVER)

myAction3 = vizact.moveTo([ball1.getPosition()[0], -1,  ball1.getPosition()[1]],speed=1) # Definition of the animation of the road (custom function that manages its resume defined from line 364 to line 439
myAction4 = vizact.moveTo([ball1.getPosition()[0], ball1.getPosition()[1], ball1.getPosition()[2]],[ball1.getPosition()[0], 4, ball1.getPosition()[1]],speed=1)
myAnimation1 = vizact.sequence(myAction3, myAction4, viz.FOREVER)

ball.addAction(myAnimation)
ball1.addAction(myAnimation1)

def changeSpeed(pos):
	print str(pos), viz.Vector(ball.getVelocity())
	ball.setVelocity([0, pos, 0]) 
	ball1.setVelocity([0, pos, 0]) 

####	ball.setSpeed(pos) 
####	ball1.setSpeed(pos) 

slider = viz.addSlider()
slider.setPosition([.5,.5,0])

#Setup callbacks for slider events
vizact.onslider(slider, changeSpeed)
I really appreciate any help you may give me.
Valeria
Reply With Quote
  #2  
Old 03-17-2015, 03:33 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Animation paths may work for you. You can link the ball to an animation path and then change the path's speed.
Reply With Quote
Reply

Tags
animation, dynamic, sequences, speed, update

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Clarification on CAL3D Avatar Animation in Vizard shivanangel Vizard 2 11-22-2010 08:16 AM
How to make character animation sequence wchoi Vizard 3 01-22-2010 09:35 AM
speed on animation path whj Vizard 8 11-17-2008 08:41 PM
animation sequence pkhoosh Vizard 2 01-23-2006 09:03 AM
animation sequence shai Vizard 1 10-27-2004 11:09 AM


All times are GMT -7. The time now is 11:35 AM.


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