Title: OGRE Programming
1OGRE Programming
2Contents
- Take an Entity
- Animate it
- Have it walk between predefined points.
- Use Quaternion for rotation to keep the Entity
facing the direction it is moving
2
3Setting up the scene
In DemoApplicationcreateScene 1. Set the
default lighting. 2. Create the entity for the
robot 3. Create the scene node which is attached
with an entity of the robot. 4. Create the
walking list which consists of a set of locations
(i.e. points) 5. Create objects for the locations
specified by the walking list. 6. Set the camera
to look at the scene.
4Animating and Moving the Robot
- In DemoFrameListenerframeStarted
- There are three items that we have to do.
- Animate the robot according to the state of the
robot - idle and walk
- 2. Translate the robot from one location to
another location - using interpolation method.
- 3. If the facing direction of the robot is not
consistent - with the walking direction, the orientation
of the robot - should be changed.
5Animating the robot based on its state
Set state AnimationState mAnimationState mAnima
tionState mEntity-gtgetAnimationState("Idle") mA
nimationState-gtsetLoop(true) mAnimationState-gtset
Enabled(true) Animate mAnimationState-gtaddTime
(evt.timeSinceLastFrame) Remark use
OgreMeshViewer and view the mesh
6References http//www.ogre3d.org/wiki/index.php
/Intermediate_Tutorial_1