#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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
|
|||
|
|||
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() ) |
#4
|
|||
|
|||
Works perfectly! Thanks again for the help.
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to track the actual viewpoint | Jerry | Vizard | 3 | 05-25-2016 10:44 AM |
viewpoint rotate | bionic1 | Vizard | 1 | 01-27-2010 10:32 AM |
Avatar w/ hat cannot look at viewpoint | TrashcanPatrol | Vizard | 5 | 08-19-2008 09:26 AM |
3d viewpoint movement | spacefarer | Vizard | 9 | 07-25-2006 04:37 PM |
VRML Viewpoint error | bstankie | Vizard | 1 | 03-11-2003 03:10 PM |