Game Development Community

T3D Easing/Tweening system

by Necrode · in Torque 3D Professional · 06/01/2009 (8:19 am) · 5 replies

Hello,

Does anyone have a T3D easing/tweening system for moving objects around where you specify a new location, duration, type of transition (linear, easeIn, etc)?

I came across this TGE/TGEA resource but had much difficulty implementing it.
http://www.garagegames.com/community/resources/view/14863

Animations done purely with torquescript's "schedule" are choppy. If there is no practical T3D easing/tweening system then I may have to go this route. I understand that applying acceleration to the object instead will smooth out the animation. Really what I'm after here is to know what the best course of action is. Any other links/resources would be appreciated!

Thanks!

About the author

They locked me in here with a computer, and said I don't get to leave until I've completed a computer game.


#1
06/01/2009 (9:36 am)
Make sure you follow that Gem #3 Ease step by step, but first, complete Gem #2 Animation threads. I had no problem integrating it into Torque3D.
#2
06/01/2009 (10:13 am)
I could be wrong, but I think that resource is for adding ease in/out to animation threads, not necessarily object positions.

There is a system in torque for specifying a path and interpolating a player or camera around it, though its pretty old TGE code.

If that is more what you are looking for, someone else might have to chime in on how to use it...
#3
06/02/2009 (12:54 pm)
Actually, that easing solution is a generic solution if I remember well. It has functions to retrieve an eased value given the range, the current position during the action and the easing type. I'm not 100% sure though.
#4
06/02/2009 (1:34 pm)
If we have a curve(path) .. for example y=x^2 and if we want to interpolate the position of the playback in time,we can't use the curve in this form.
Actually we can not interpolate the position from -0.5 to 0.5 ,according to the example.
We need a little adjustment.
y=x^2 needs to move a bit right and we got y=(x-0.5)^2
That will interpolate correct for sure.

But if we have a more complexed curve like Quartic,then we'll need not only to move left/right/up , but also scale the curve.
Doing it on a hand can be a nightmare even for a mathematician.

In Easing resource we do not need to care about that.
We take a beginning value,we know the end value.
We have a duration and ready 10 curves.
#5
06/08/2009 (12:43 pm)
The Plastic Games resource I was talking about implements the following in mEase.h:

// t: current time (within duration) 
// b: beginning value, 
// c: change in value, 
// d: duration, 
// a: amplitude (optional), 
// p: period (optional), 
// s: overshoot amount (optional)

F32 mLinearTween(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInQuad(F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutQuad(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutQuad(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInCubic(F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutCubic(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutCubic(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInQuart(F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutQuart(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutQuart(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInQuint(F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutQuint(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutQuint(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInSine(F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutSine(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutSine(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInExpo(F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutExpo(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutExpo(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInCirc (F32 t, F32 b, F32 c, F32 d);
F32 mEaseOutCirc (F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutCirc(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInElastic(F32 t, F32 b, F32 c, F32 d, F32 a, F32 p);
F32 mEaseOutElastic(F32 t, F32 b, F32 c, F32 d, F32 a, F32 p);
F32 mEaseInOutElastic(F32 t, F32 b, F32 c, F32 d, F32 a, F32 p);
F32 mEaseInBack(F32 t, F32 b, F32 c, F32 d, F32 s);
F32 mEaseOutBack(F32 t, F32 b, F32 c, F32 d, F32 s);
F32 mEaseInOutBack(F32 t, F32 b, F32 c, F32 d, F32 s);
F32 mEaseOutBounce(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInBounce(F32 t, F32 b, F32 c, F32 d);
F32 mEaseInOutBounce(F32 t, F32 b, F32 c, F32 d);

It doesn't get easier than that. No pun intended. :)