WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Moving objects smoothly (https://forum.worldviz.com/showthread.php?t=3101)

flip321 11-29-2010 12:47 PM

Moving objects smoothly
 
Hey,

does anyone know how to make a movement of an object smooth? I mean that the acceleration and breaking process is smooth and gives it a more realistic feeling?

Thanks a lot
flip321

Jeff 12-01-2010 09:29 AM

Can you provide more detail about what you are trying to do?

flip321 12-08-2010 05:29 AM

Of course:
Let's say I want to move an imported 3D-object from it's position to the center of the stage/screen whatever with the coordinates [0,0,0]. The skript works, but in order to make it look more realistic in a physical way, I want the beginning of the movement progress to start slower as well as the ending of the movement.
In other words I want the speed of the movement to increase in the beginning and decrease in the end, and NOT to have a constant movement speed over the whole time.

Here's a part of the script I'm using right now:

Quote:

def show_moviepreviews():
moveToStage = vizact.moveTo([0, 0, 0],time=1)
movie_icon.addAction(moveToStage)

Thanks a lot,
Philipp

Huib 12-09-2010 12:32 AM

If you have some t, going linearly from 0.0 to 1.0, first transform it before passing it to setPosition or whatever move function.

Example for slow in, slow out:

new_t = (1.0 - math.cos(math.pi * t)) * 0.5

bonus for fast in, slow out:

new_t = math.sin(((1.0 - t) ** 2 + 1) * math.pi / 2.0) ** 2

these new_t values will lie between 0.0 and 1.0 as well.

flip321 02-24-2011 03:45 AM

hm, could you add this into my example skript? I can't really picture who I should integrate it...
Isn't there any easier way like giving an extra parameter along with the "move function" in order to get the same results?

But thanks a lot in advance!!! I appreciate it!

Huib 12-21-2011 02:01 AM

Better approach: see the help for interpolation modes, for instance:

Code:

def show_moviepreviews():
    moveToStage = vizact.moveTo([0, 0, 0], time=1, interpolate=vizact.easeInOut)       
    movie_icon.addAction(moveToStage)



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

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