WorldViz User Forum constant speed on animation path
 Register FAQ Search Today's Posts Mark Forums Read

#1
04-21-2009, 09:16 AM
 whj Member Join Date: Apr 2008 Posts: 60
constant speed on animation path

Hello, By pressing 'a', my script simply starts a car in a road. My question is how to make the car move in a constant speed. I use path.constantspeed(), but seems to me that the car will accelerate when it move along the circle. Does the way I add control point have problem?

Code:
```import viz
import math
import time

viz.go()

mymini.setPosition(-10,-10,0)

y_pos_car = 0.14
positions = [ [2,y_pos_car,50], [1,y_pos_car,35], [0,y_pos_car,25], [-1,y_pos_car,15],
[-1,y_pos_car,8], [-25,y_pos_car,0], [-15,y_pos_car,-8], [-10,y_pos_car,-10],
[-6,y_pos_car,-10], [-3,y_pos_car,-12], [0,y_pos_car,-18], [3,y_pos_car,-17],
[6,y_pos_car,0], [10,y_pos_car,4], [15,y_pos_car,2], [25,y_pos_car,-8],
[35,y_pos_car,-16], [50,y_pos_car,-10], [60,y_pos_car,20], [80,y_pos_car,40],
[200,y_pos_car,200] ]
for x in range(0,len(positions)):
cp.setPosition(positions[x])

path.loop(viz.OFF)
path.translatemode(viz.BEZIER)
path.setAutoRotate(viz.ON)

def mytimer(num):
pass

def onkeydown(key):
if key == 'a':
path.play()
path.constantspeed(viz.ON,6.7)

viz.callback(viz.KEYBOARD_EVENT, onkeydown) #keyboard event callback
viz.callback(viz.TIMER_EVENT, mytimer) #timer event callback
viz.starttimer(0,1/60,viz.FOREVER) #timer```

BTW, I cannot attach my models zip file here because it always said "Upload of file failed". What should I try?

Thanks a lot!

Last edited by whj; 04-21-2009 at 09:23 AM.
#2
04-21-2009, 11:17 AM
 Jeff WorldViz Team Member Join Date: Aug 2008 Posts: 2,457
Constant speed will not work with the translate mode you are using. You could try using the linear mode or creating your animation in modeling software like 3ds Max.
#3
04-21-2009, 01:29 PM
 whj Member Join Date: Apr 2008 Posts: 60
Thanks anyway.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post Enlil Vizard 3 11-24-2008 04:23 PM whj Vizard 8 11-17-2008 07:41 PM whj Vizard 10 10-06-2008 04:38 PM djdesmangles Vizard 2 06-11-2007 03:37 PM djdesmangles Vizard 0 06-06-2007 11:03 AM

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