I want model walk by pressed W, A, S, D key. i can animate model, but i cant make it move by pressed a key. i have walkthrough all of tutorial and i serch in the forum, but i still have a problem.
i'm not good in English. Sorry.....
Help me Please...
Stupid question about control model
-
- Posts: 16
- Joined: Tue Dec 27, 2005 10:13 am
- Location: Johannesburg, South Africa
You'll need an IEventReceiver to capture the keyboard input.
Cast your object as IAnimatedMeshSceneNode and use AnimationSpeed to make the model walk. (IE set the speed to 0 by default and when the user presses a key set the AnimationSpeed to whatever it needs to be.).
Lastly you can use SetFrameLoop to manage what of the mesh is rendered.
Then you just need to update the position and rotation of the object depending on the speed you want the model to walk and its rotation
Cast your object as IAnimatedMeshSceneNode and use AnimationSpeed to make the model walk. (IE set the speed to 0 by default and when the user presses a key set the AnimationSpeed to whatever it needs to be.).
Lastly you can use SetFrameLoop to manage what of the mesh is rendered.
Then you just need to update the position and rotation of the object depending on the speed you want the model to walk and its rotation
Hi !
I think you should use an Animator like this:
case KEY_KEY_W:
{
vector3df moveForward = yourNodeName->getAbsolutePosition();
moveForward.Y += 50;
ISceneNodeAnimator* runto = SceneManager->createFlyStraightAnimator(
yourNodeName->getAbsolutePosition(), moveForward, time, 0);
yourNodeName->addAnimator(runto);
runto->drop();
}
PS : "time" is a constant which will define your model speed.
I think you should use an Animator like this:
case KEY_KEY_W:
{
vector3df moveForward = yourNodeName->getAbsolutePosition();
moveForward.Y += 50;
ISceneNodeAnimator* runto = SceneManager->createFlyStraightAnimator(
yourNodeName->getAbsolutePosition(), moveForward, time, 0);
yourNodeName->addAnimator(runto);
runto->drop();
}
PS : "time" is a constant which will define your model speed.