![]() |
VR-Forces 4.0.4 Class Documentation
|
VR-Forces includes a simple, kinematics-based model for motion of missiles.
Implemented in class: DtMissileManeuverActComponent
The model accepts the following control inputs:
Other factors taken into consideration:
The missile is maneuverable (respond to steering acceleration inputs) for the duration of the max-burn-time parameter, whereupon it will go into free fall. Missiles are typcially configured with high maximum speeds, making them sensitive to low frame rates.
The model must be ticked periodically. Each tick, the length of time of the previous tick, dT, is available as a parameter in the current tick. Below is an outline of what the model does each tick:
DtVector localAcceleration; localAcceleration[0] = 0; localAcceleration[1] = 0; localAcceleration[2] = -9.8; // due to gravity, in meters/seconds squared<br>
Otherwise, it initializes the local acceleration from the inputs provided on the missile maneuver port:
localAcceleration[0] = myMissileManeuvPortIntf->maneuverAccelXPort()-> value();
localAcceleration[1] = myMissileManeuvPortIntf->maneuverAccelYPort()-> value();
localAcceleration[2] = myMissileManeuvPortIntf->maneuverAccelZPort()-> value();
DtVector localVelocity; DtVecScale(localAcceleration, dT, localVelocity); DtVecAdd(localVelocity, myMissileState->localVelocity(), localVelocity);
DtVector normalizedVelocity; DtVecNormalize(localVelocity, normalizedVelocity); DtVecScale(normalizedVelocity, myMissileState->maxSpeed(), localVelocity);
DtVector newPosition; DtVector deltaPosition; DtVecScale(localVelocity, dT, deltaPosition); DtVecAdd(missileState->localPosition(), deltaPosition, newPosition);
double heading = atan2(localVelocity[0], localVelocity[1]); double pitch = atan2(localVelocity[2], sqrt(localVelocity[0] * localVelocity[0] + localVelocity[1] * localVelocity[1]));