PDA

View Full Version : dynamic camera views


benelux
08-17-2004, 12:07 PM
Hi,

I am trying to simulate a roller coaster ride. Is there a way to attach a camera viewpoint to a person riding up and down?

Thanks!

farshizzo
08-17-2004, 12:43 PM
Hi,

I'm not sure if I fully understand your question. Do you already have some animation data for the roller coaster that you want to apply to the viewpoint, or are you wishing to create the data dynamically? Either way, you will need to apply some position and rotation to the viewpoint within a timer. Here is some sample code that might help:viewpoint = viz.get(viz.MAIN_VIEWPOINT)

def ontimer(num):
#Get the current position and rotation of the rollercoaster
pos = getrollercoasterpos()
rot = getrollercoasterrot()

#Apply pos and rot to the viewpoint
viewpoint.translate(pos)
viewpoint.rotate(rot)
Let me know if I misunderstood your question or if you need any more help.