View Single Post
  #5  
Old 04-02-2009, 10:40 AM
just alex just alex is offline
Member
 
Join Date: Nov 2008
Posts: 18
Here's the code.

The path is static, but I've never even looked at 3ds Max, so I wouldn't know what to do, though I might be able to pick it up with google fu.
I'll give it a go, but don't know how it'll work.

Code:
import viz
import math
import vizmat
import vizinfo
import vizact
viz.go()


#Add the street and drop it a little bit to be below the avatars feet.
street = viz.add('objects/bspcity.bsp')
street.translate(0,-.2,0)

#Add car.
car = viz.add('mini.osgx')

car.setScale(.8,.8,.8)


car.translate(-23,0,-8.8)


path = viz.add(viz.ANIMATION_PATH)
positions = [[-23,0,-8.8],[-23,0,-8],[-34,0,-8],[-34,0,0],[-43,0,0],[-43,0,8],[-43,0,17]]

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


path.constantspeed(viz.ON,1)

path.loop(viz.LOOP)

#computes cubic bezier
path.computetangents()

path.translatemode(viz.CUBIC_BEZIER)

path.setAutoRotate(viz.ON)
car.link(path)

def onkeydown(key):
  if key == ' ':
    path.play()

viz.callback(viz.KEYDOWN_EVENT,onkeydown)

Last edited by just alex; 04-02-2009 at 10:44 AM.
Reply With Quote