Page 1 of 1

time

Posted: Sat Feb 21, 2004 12:58 pm
by jugurdzija
what is the easiest way to handle time based movement?
i want to move camera left or right when 6secs passes and then little pause
for a few secs and then again to the right.
and it should be nice with a little acceleration...
please reply.
thanx

Posted: Sat Feb 21, 2004 1:53 pm
by Guest

Posted: Sat Feb 21, 2004 2:26 pm
by jugurdzija
well i thought of not using quarternios...
i thought something simplier...

Posted: Sat Feb 21, 2004 4:01 pm
by Boogle
How about an animator with a state variable to say whether it's currently moving left, moving right, or waiting 6 seconds?

First you'd need a variable to keep track of when to next switch states. You'd also need to keep a velocity vector and acceleration vector if you wanted to avoid Quaternions. Each loop, affect the velocity vector based on the acceleration vector and add the velocity vector to the position. The acceleration vector would have to be negated when you've reached half the time to the next state switch to cause deceleration.

Posted: Sat Feb 21, 2004 4:11 pm
by Boogle
However, I should also point out that IrrLicht now contains a Quaternion class, conversion methods to and from Quaternions to Matrix4s, and the Quaternion Slerp function. So all the hard work has already been done, you just need to specify a starting rotation, destination rotation, and keep track of time remaining for the animation.

Posted: Sun Feb 22, 2004 3:05 pm
by jugurdzija
i added flystraight animatior but i dont know how to add some acceleration and switch beetween animators
any ideas?

Posted: Sun Feb 22, 2004 3:35 pm
by Boogle
You'll have to make your own animator. You could start off by copying the code from the FlyStraightAnimator if you wanted, but I'd recommend starting from scratch so you're not stuck trying to squeeze your requirements into the FlyStraightAnimator's framework.

Posted: Sun Feb 22, 2004 5:23 pm
by jugurdzija
well i need a specific motion that probably i will never use again so i thought not to make my own animator but to just simply change cam position in time based on basic velocity equatations (v=s/t , a=v/t hehe)

Posted: Sun Feb 22, 2004 6:20 pm
by Boogle
Making an animator isn't much work. There's only 1 required method (animate, or animateNode, or whatever it's called), into which you will put your state update and basic velocity equation stuff. You cannot add acceleration to a FlyStraightAnimator except by either modifying the engine source (not recommended for this) or copying the FlyStraightAnimator code into your own animator (you could do this to start your animator). In any case, you're going to have to do some work to get what you want no matter what method you choose. IrrLicht does not have an AcceleratedMotionAnimator.

Posted: Sun Feb 22, 2004 6:48 pm
by jugurdzija
here is the thing i need to do:
i have a room with few chairs,camera in the middle of it.camera needs to move to the left about 0.5 meter with acceleration,then pauses go into initial position and then does the same to the other side.

i have simple cameraNode and
vector3df camPosition;
camPosition.X=0;
.
.
.

also i have to change only x-position of the camera.
i didnt figure out that time issue...