WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-23-2009, 11:56 PM
Chrissy2009 Chrissy2009 is offline
Member
 
Join Date: May 2009
Posts: 33
Draw Vector in viewpoint lookat direction

Hi,

I want to draw a line from one object in a special direction for a given amount.

The amount (or the length) is from a slider and that works fine!

But the direction of the line should be the viewpoint lookat direction.

So for example my viewpoint is behind of a ball and now I want to draw a line to see how the ball will roll.

I use:

Code:
current = balls[0].get(viz.POSITION)
vector = balls[0].get(viz.LOOK)
future = vizmat.MoveAlongVector(current, vector, slider.get()*2)
hit = viz.intersect(current, future)
viz.startlayer(viz.LINE_LOOP)
viz.vertexcolor(viz.RED)
viz.linewidth(3)
viz.vertex(current)
viz.vertex(future)
rod = viz.endlayer()
But this doesn't work. :-(

Can anybody help me?

And additionally it would be very great if the vector will be changed depending on a change of the viewpoint. If I turn the viewpoint left or right, the vector will be drawn in the corresponding direction.
Reply With Quote
  #2  
Old 05-25-2009, 10:19 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Set the parent of the rod to the ball so that it appears on the ball. Now it is at the origin of the world.

You can do the calculation again and set the position of the second vertex every time the view moves if you like.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #3  
Old 05-30-2009, 12:50 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Actually, don't set the parent of the rod to the ball. That won't fix things. I was wrong.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
Reply

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
Avatar w/ hat cannot look at viewpoint TrashcanPatrol Vizard 5 08-19-2008 08:26 AM
VRML Viewpoint error bstankie Vizard 1 03-11-2003 02:10 PM


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


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