WorldViz User Forum Rotate Viewpoint 360 Around Point/Object
 Register FAQ Search Today's Posts Mark Forums Read

#1
01-24-2012, 12:39 PM
 hotshotiguana 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.

Chris
#2
01-24-2012, 04:52 PM
 hotshotiguana 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
#3
01-25-2012, 11:56 AM
 farshizzo 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
viz.go()

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

# 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'

#4
01-25-2012, 05:36 PM
 hotshotiguana Member Join Date: Mar 2011 Posts: 22
Works perfectly! Thanks again for the help.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Getting Vizard Help with AI Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post Jerry Vizard 3 05-25-2016 09:44 AM bionic1 Vizard 1 01-27-2010 09:32 AM TrashcanPatrol Vizard 5 08-19-2008 08:26 AM spacefarer Vizard 9 07-25-2006 03:37 PM bstankie Vizard 1 03-11-2003 02:10 PM

All times are GMT -7. The time now is 10:00 PM.