WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-02-2008, 01:48 PM
whj whj is offline
Member
 
Join Date: Apr 2008
Posts: 60
speed on animation path

Hello Jeff,

Previously you helped me out with the problem that how to get the position of an object two seconds ahead. Thanks a lot. Here is the code with slight change on your code, in which a semi-transparent ball two seconds ahead of another ball on animation path. I have a question about their speed. Why the speed of balls changes a lot along the animation path although I used path.constantspeed(viz.ON,4). How can I get a smooth constant speed? Thanks.


import viz
viz.go()

viz.add('tut_ground.wrl')

ball = viz.add('ball.wrl')
ball.alpha(.5)
ball2 = viz.add('ball.wrl')

viz.MainView.move(0,3,-30)

path = viz.add(viz.ANIMATION_PATH)
path2 = viz.add(viz.ANIMATION_PATH)

positions = [ [2,0.15,50], [1,0.15,35], [0,0.15,25], [-4,0.15,15], [-10,0.15,8], [-25,0.15,0], [-15,0.15,-8], [-10,0.15,-10], [-6,0.15,-12], [-3,0.15,-15], [0,0.15,-18], [3,0.15,-16], [6,0.15,-8], [10,0.15,2], [15,0.15,0], [25,0.15,-12], [35,0.15,-12], [50,0.15,-12], [70,0.15,10], [90,0.15,30], [140,0.15,120] ]

for x in range(0,len(positions)):
cp = viz.add(viz.CONTROL_POINT)
cp.setPosition(positions[x])
path.add(cp,x+1)
path2.add(cp,x+1)


path.constantspeed(viz.ON,4)
path2.constantspeed(viz.ON,4)


path.loop(viz.OFF)
path2.loop(viz.OFF)

path.translatemode(viz.BEZIER)
path2.translatemode(viz.BEZIER)

path.setAutoRotate(viz.ON)
path2.setAutoRotate(viz.ON)

#Link ball and ball2 to their paths
ball.link(path)
ball2.link(path2)


#start playing the first animation path immediately
path.play()

#start playing the second animation path after two seconds
vizact.ontimer2(2, 1, path2.play)
Reply With Quote
 

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
real time collision on animation path whj Vizard 10 10-06-2008 04:38 PM
Animation Path djdesmangles Vizard 2 06-11-2007 03:37 PM
Animation Path djdesmangles Vizard 0 06-06-2007 11:03 AM
Animation Tracks.... k_iwan Vizard 2 03-26-2007 05:52 PM
Jumpy animation Elizabeth S Vizard 1 11-08-2006 02:11 PM


All times are GMT -7. The time now is 09:43 PM.


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