Change the direction and speed of an entity while flying during runtime
You can change the object position during runtime by calling the following action:
ACTION_START_MODEL_MOTION (Location newLocation, LinearVec newSpeed)
- The newLocation is the object required 6Dof state.
- The newSpeed is the object required speed in world coordinates.
To set the new entity in world coordinates X = 1000, Y = 2000, Z = 0, and Yaw = 20degs, with a speed of 200m/sec, use:
- LinearVec newPos(1000, 2000, 0);
- AngularVec newOri(Ang::zero(),Ang::zero(),Ang(Deg(20.0)));
- LinearVec newSpeed(200*sinf(20.0f * RADTODEG), 200*cosf(20.0f * RADTODEG) , 0);
- CALL_ENTITY_ACTION_2(_pOwnerEntity, EntityWorld::ACTION_START_MODEL_MOTION, Location(newPos,newOri),newSpeed);