WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-26-2009, 07:03 AM
sl0bz sl0bz is offline
Member
 
Join Date: Jun 2008
Posts: 6
Viewpoint Compass

Hi,

I am creating an application that has a pretty large CAD model and when the users are navigating through the model there have been complaints that they are losing track of where they are in the model. I want to create a "you-are-here" type window that the user can pop up on the screen.

I have been experimenting with addWindow() and addView() to get a top down view of the environment. I would like to be able to insert an arrow over this window that follows the position and orientation of the main viewpoint. Is this possible?

Thanks!

--
Patrick
Reply With Quote
  #2  
Old 08-28-2009, 03:06 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is a sample script that shows how to overlay objects on a sub-window:
Code:
import viz
import vizact
viz.go()

#Add the room and arrow
room = viz.add('gallery.ive')

# Create a new window in the upper left corner
UpperLeftWindow = viz.addWindow(pos=(0,1.0),size=(0.2,0.2))
UpperLeftWindow.visible(0,viz.SCREEN)

# Create a new viewpoint
BirdView = viz.addView()

#Attach the bird's eye view to the upper left window
UpperLeftWindow.setView(BirdView)

#Move the view above the center of the room
BirdView.setPosition([0,9,0])

#Rotate the view so that it looks down
BirdView.setEuler([0,90,0])

#Overlay arrow on sub window (20x20 pixels)
arrow = viz.addTexQuad(parent=viz.ORTHO,scene=UpperLeftWindow,size=20)
arrow.texture(viz.add('arrow.tif'))

def UpdateArrow():
	
	#Get the current head orientation and position
	yaw,pitch,roll = viz.MainView.getEuler()
	pos = viz.MainView.getPosition()
	
	# Place arrow on top of viewpoint
	x,y,z = UpperLeftWindow.worldToScreen(pos,mode=viz.WINDOW_PIXELS)
	arrow.setPosition([x,y,0])
	
	# Rotate arrow to match yaw rotation
	arrow.setEuler([0,0,-yaw])
	
vizact.ontimer(0,UpdateArrow)
Reply With Quote
  #3  
Old 09-02-2009, 12:27 PM
sl0bz sl0bz is offline
Member
 
Join Date: Jun 2008
Posts: 6
That worked well for me, thanks for your help!
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
How to track the actual viewpoint Jerry Vizard 3 05-25-2016 09:44 AM
Draw Vector in viewpoint lookat direction Chrissy2009 Vizard 2 05-30-2009 12:50 AM
Avatar w/ hat cannot look at viewpoint TrashcanPatrol Vizard 5 08-19-2008 08:26 AM
3d viewpoint movement spacefarer Vizard 9 07-25-2006 03:37 PM
VRML Viewpoint error bstankie Vizard 1 03-11-2003 02:10 PM


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


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