WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Animating an out-of-body transition (https://forum.worldviz.com/showthread.php?t=210)

vr_boyko 09-21-2004 09:59 AM

Animating an out-of-body transition
 
greetings!

I would like to construct an animation that swings the viewport around to look at the avatar representing the person who is looking through the viewport while moving away to a pre-determined position external position, a sort of an out-of-body experience. Currently I am trying to achieve this by using the commands:
.goto(x,y,z,vel)
and
.lookat(x,y,z)

my actual code looks like this:

def outofmymind(): # animate a smooth POV transition
global myAvatar
myApos = myAvatar.get(viz.POSITION)
myPOV = viz.get(viz.MAIN_VIEWPOINT)
myPOV.lookat(myApos)
myPOV.goto(5,5,5,.85) #just an arbitrary external place


however, instead of going to (5,5,5) in about 2 seconds while looking at myAvatar, the viewport just sinks down (-y)

any comments on my (apparently wrong) code and any suggestions for improvement are very appreciated.

Thanks!

btw, what formatting do you use especially for code, and how do I access it from "post new thread" webpage (is it in enhanced mode?)

farshizzo 09-21-2004 10:30 AM

Hi,

Take a look at the .gotomode and .pivot commands. Also, there is an example script in the [Vizard20]/examples/advanced directory called animateview.py which shows how to use these functions.

Basically what you would want to do is something like the following:
Code:

def outofmymind(): # animate a smooth POV transition
        myApos = myAvatar.get(viz.POSITION)
        myPOV = viz.get(viz.MAIN_VIEWPOINT)
        myPOV.gotomode(viz.BLEND_ROTATE) #Also try out        viz.PIVOT_ROTATE, see which one you like better
        myPOV.pivot(myApos)
        myPOV.goto(5,5,5,.85) #just an arbitrary external place

To format some text as code you can press the button with the "#" symbol or you can manually add the following tags around it: [ code ]some code[ /code ]

vr_boyko 09-21-2004 11:30 AM

works great! thanks
 
I found that the BLEND_ROTATE feels more natural, as much as an out-of-body experience can feel natural.

thanks again!


All times are GMT -7. The time now is 06:24 AM.

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