i want my model walk!!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
byelan74
Posts: 28
Joined: Sat Dec 24, 2005 11:29 am

i want my model walk!!

Post by byelan74 »

i want to use "createFlyStraightAnimator" to move my model in my direction.

i have direction but i cant make it move.

my direction is
core::vector3df direction( sin( ( Mynode->getRotation().Y + 180) * core:: PI/180.0f ), 0, cos( ( Mynode->getRotation().Y + 180 ) * core:: PI/180.0f ) );
how can i make it walk.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

http://irrlicht.sourceforge.net/docu/cl ... nager.html

Code: Select all

virtual ISceneNodeAnimator * 	createFlyStraightAnimator (const core::vector3df &startPoint, const core::vector3df &endPoint, u32 timeForWay, bool loop=false)
the key thing about FlyStraightAnimators is that they fly straight. if you want it to change direction as you rotate you're better off just using setPosition(getPosition()*direction*time)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
byelan74
Posts: 28
Joined: Sat Dec 24, 2005 11:29 am

Post by byelan74 »

Thanks....

But set position doesnt smooth.

how can i make it smooth.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

To make it smooth with setPosition you have to update the position a little bit each frame, so you can use d = s * t and calculate the time since the last frame, and then multiply that by the speed you want the model to walk at, and then that gives you the distance the model should be moved in that frame. The overall effect will be of smooth movement.
Image Image Image
byelan74
Posts: 28
Joined: Sat Dec 24, 2005 11:29 am

Post by byelan74 »

i'm sorry that i stupid :oops: .

but......How can i calculate the time since the lanst frame.
Conquistador
Posts: 340
Joined: Wed Sep 28, 2005 4:38 pm
Location: Canada, Eh!

Post by Conquistador »

Look up ITimer.

Code: Select all

ITimer* Timer = Device->getTimer();
u32 lastTime = Timer->getRealTime();
u32 timeSinceLastFrame = 0;

while (Device->run())
{
   timeSinceLastFrame = lastTime - Timer->getRealTime();
   lastTime = Timer->getRealTime();
}
It should go something like that.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
byelan74
Posts: 28
Joined: Sat Dec 24, 2005 11:29 am

Post by byelan74 »

Thanks for everyone
Post Reply