WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-24-2012, 12:39 PM
hotshotiguana hotshotiguana is offline
Member
 
Join Date: Mar 2011
Posts: 22
Rotate Viewpoint 360 Around Point/Object

I am looking at a vizshape.addBox in my Vizard environment and would like to smoothly rotate the viewpoint 360 degrees around this point to show the user all sides. I am not that familiar with 3D rotations, but I believe I only want to change the yaw for this to happen correctly. I have tried all sorts of different spin, goto, and setEuler combinations but nothing works as I would like.

I can get the position of the object with the getPosition function, so I am hoping to use a combination of this position and another function to solve this problem.

Any assistance would be greatly appreciated. Also, please feel free to ask for more information.

Chris
Reply With Quote
  #2  
Old 01-24-2012, 04:52 PM
hotshotiguana hotshotiguana is offline
Member
 
Join Date: Mar 2011
Posts: 22
I found this example on the worldviz website:
http://docs.worldviz.com/vizard/exam...iewAnimate.htm

It is very similar to what I am looking for, but is there a way to make the transition between pressing 1-4 smooth, i.e. the center of the pivot object is the axis and the user is making a smooth 360 degree rotation around the center leaving a small radius of space between the camera and the object as the rotation happens?

Also, I keep running into quaternion rotation when I google this topic, but I do not see any examples of setQuad on the Viz website. Is there a good reference to learning what this function can do?

Thanks,
Chris
Reply With Quote
  #3  
Old 01-25-2012, 11:56 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is an example that shows one way of accomplishing this. I created a simple function LookAtBox that places the viewpoint at a specific distance and yaw from the box. I then use a task function to continually call the function for a 360 degree spin.
Code:
import viz
import vizact
import vizshape
import viztask
viz.go()

box = vizshape.addBox(color=viz.GREEN,pos=(0,2,0))
vizshape.addGrid(color=[0.3]*3)

def LookAtBox(yaw,distance):
	pos = box.getPosition()
	viz.MainView.setPosition(pos)
	viz.MainView.setEuler([yaw,0,0])
	viz.MainView.move([0,0,-distance])

def SpinAroundBoxTask():

	# Create mix parameter for yaw (0-360) for 5 seconds
	yawAnimate = vizact.mix(0,360,time=5.0)

	# Animate viewpoint spinning around box at 8 meters away
	yield viztask.waitCall( LookAtBox , yawAnimate, 8.0 )

	print 'Finished spinning'

viztask.schedule( SpinAroundBoxTask() )
Reply With Quote
  #4  
Old 01-25-2012, 05:36 PM
hotshotiguana hotshotiguana is offline
Member
 
Join Date: Mar 2011
Posts: 22
Works perfectly! Thanks again for the 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
viewpoint rotate bionic1 Vizard 1 01-27-2010 09:32 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 03:13 PM.


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