Page 1 of 1

Rotation animator with deceleration over time

Posted: Wed May 25, 2011 7:39 pm
by andrew
I am fairly inexperienced with Irrlicht and am trying to figure out how to create a rotation animator that decelerates over time. From looking around I need to make my own animator or set up a physics engine. I'm looking for a simple solution here so I think the physics engine approach might be a bit much.

For a custom animator I would have something like

Code: Select all

createRotationAnimator(vector3df(0, 1, 0), 1.0);
which behaves as normal but decelerates to 0 over the course of 1 second.

I was wondering if I am approaching this the right way or if perhaps I am missing something and I can achieve this functionality some other way.

Posted: Wed May 25, 2011 7:46 pm
by Radikalizm
Yes, a custom animator would be the easiest way to do this

Posted: Wed May 25, 2011 9:51 pm
by andrew
Radikalizm wrote:Yes, a custom animator would be the easiest way to do this
Thanks, I'll look into this. Do you know of any resources that would help with this?

Posted: Wed May 25, 2011 10:45 pm
by Xaryl
You can look at the source code of an inbuilt animator.
Try a simple one, maybe CSceneNodeAnimatorFlyCircle
and don't worry about serializeAttributes and deserializeAttributes for your very first animator.

Basically, the animateNode(ISceneNode* node, u32 timeMs) is called every time smgr->drawAll() is called,
so just do what you need with the node in that function.

Posted: Wed May 25, 2011 10:59 pm
by andrew
Time to go fishing in the source code then. Thanks for the info!