WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 06-19-2006, 01:51 PM
paulpars paulpars is offline
Join Date: May 2006
Location: Kingston, Ontario
Posts: 14

i am confused as to how this works, and i can't find any documentation for it either...i am trying to create a vector out the front of the car i am driving in but the vector always goes out the back even when i'm driving forward... here's what my code looks like:

		#Get the car's current position.
		current = car.get(viz.POSITION)
		#Get the vector for the direction in which the car is positioned.
		vector = car.get(viz.LOOK)
		#Find the car's future position if it travels along the vector 30 meters.
		future = vizmat.MoveAlongVector(current, vector,30)
		#Draw a line between the current and future positions and 
		#see if it intersects anything.
		hit = viz.intersect(current, future)
		line = viz.endlayer()

Reply With Quote
Old 06-19-2006, 04:42 PM
Gladsomebeast Gladsomebeast is offline
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
To reverse the direction of a vector, multipy it by a negative. I would change the following in your code:

future = vizmat.MoveAlongVector(current, vector,-30) #added a negative sign
Paul Elliott
WorldViz LLC
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

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

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