WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 03-09-2012, 08:31 AM
nabrahamson nabrahamson is offline
Join Date: Sep 2011
Posts: 36
Get Objects Angle Relative to the screen/viewpoint

I am working on a problem where we have a mouse pointer in our scene that I have either oriented so that it is positioned to the normal vector of a surface, or that it points at the center of the bounding box for an object.

The pointer is modeled to look like a teardrop where the point of the teardrop is "touching" the surface of the object it is pointing at. Due to the rotation of the pointer, there are cases were the point of the teardrop are obscured by the rest of the model. To resolve this, I want to try to compare the angle vector of this teardrop model to the viewpoint to see if the model is obscured.

I think I have half of what I need by using the command

To get a vector representing what the camera is looking at. What I need is a vector in the same coordinate system as this screenToWorld direction vector to determine if the pointer is being obscured by itself.
Reply With Quote
Old 03-09-2012, 09:39 AM
nabrahamson nabrahamson is offline
Join Date: Sep 2011
Posts: 36
I think I have come up with a solution that I'll share here:

In addition to the window vector above, I am taking the point that the mouse pointer intersects with and the center of the bounding box, and making a vector using those two points. With that vector, I can figure out the angle between the window vector.

winVec = viz.MainWindow.screenToWorld([0,5,0.5]).dir
objAngle = [bbCenter[i] - objPoint[i] for i in range(len(objPoint))]

viewAngle = Vector.cross(Vector.norm(objAngle), Vector.norm(winVec))
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble picking text3d objects Salvar Vizard 4 12-01-2010 03:07 PM
static or dynamic objects shahramy Vizard 2 11-10-2010 12:32 AM
Semi-circle array containing target and distractor objects ptjt255 Vizard 3 08-04-2009 03:09 AM
Lightwave objects rotation problem hosier Vizard 6 02-13-2009 12:04 PM
Could not find plugin to load objects... halley Vizard 1 05-30-2006 11:01 AM

All times are GMT -7. The time now is 02:28 AM.

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