![]() |
VR-Forces Developer's Guide
|
Implementation of a buoyancy model using RK4 integration.
Basic usage is to attach buoyancy floats, set position/orientation, and tick every frame.

Classes | |
| struct | Acceleration |
| struct | AppliedForce |
| struct | BuoyancySample |
| struct | Derivative |
| struct | State |
Public Types | |
| typedef std::vector < BuoyancySample * > | BuoyancySampleVec |
Public Member Functions | |
| DtRk4MotionModel (makVrv::DtDe &de) | |
| virtual | ~DtRk4MotionModel () |
| void | tick (double dt) |
| DtVector | velocity () const |
| DtVector | position () const |
| DtTaitBryan | orientation () const |
| void | setPosition (const DtVector &position) |
| void | setOrientation (const DtTaitBryan &orientation) |
| void | setTargetOrientation (const DtTaitBryan &orientation) |
| void | setSpeed (double speed) |
| void | sink () |
| void | unsink () |
| bool | isSinking () |
| void | setSinkingSpeedScale (double scale) |
| double | sinkingSpeedScale () const |
| void | setRotationalInertia (double pitchInertia, double rollInertia) |
| void | applyForce (const DtVector &offset, const DtVector &force) |
| void | applyHeadingTorque (double magnitude) |
| void | applyRollTorque (double magnitude) |
| void | addBuoyancySample (BuoyancySample *bs) |
| BuoyancySampleVec & | buoyancySamples () |
| void | setOrigin (const DtVector &pos) |
| DtVector | origin () const |
| void | moveOrigin (const DtVector &pos) |
Static Public Attributes | |
| static const double | theTimeStep |
Private Member Functions | |
| DtVector | worldPos (const DtVector &bodyOffset) const |
| DtTaitBryan | worldOri (const DtTaitBryan &bodyOffset) const |
| DtVector | localPos (const DtVector &pos) const |
| DtTaitBryan | localOri (const DtTaitBryan &ori) const |
| virtual void | slot_coordinateSystemChanged () |
| Derivative | evaluate (const State &initial, double dt, const Derivative &d) |
| Acceleration | acceleration (const State &initial, double dt) |
Friends | |
| struct | BuoyancySample |
Additional Inherited Members | |
Protected Types inherited from makVrv::DtSignalConnectionManager | |
| typedef std::vector < boost::signalslib::connection > | Connections |
Protected Member Functions inherited from makVrv::DtSignalConnectionManager | |
| DtSignalConnectionManager () | |
| virtual | ~DtSignalConnectionManager () |
| void | manageConnection (const boost::signalslib::connection &conn) |
| DtSignalConnectionManager & | operator+= (const boost::signalslib::connection &conn) |
| bool | blockConnections (bool blocked) |
| int | numberOfConnections () const |
| void | disconnectSignals () |
| bool | connectionsBlocked () const |
Protected Attributes inherited from makVrv::DtSignalConnectionManager | |
| Connections | myConnections |
| bool | myConnectionsBlocked |
| bool | myIndiviualConnectionedBlocked |
| std::vector < boost::signalslib::shared_connection_block * > | mySharedConnectionsBlockManager |
| typedef std::vector<BuoyancySample*> makVrv::DtRk4MotionModel::BuoyancySampleVec |
| makVrv::DtRk4MotionModel::DtRk4MotionModel | ( | makVrv::DtDe & | de | ) |
CTOR.
|
virtual |
DTOR.
| void makVrv::DtRk4MotionModel::tick | ( | double | dt | ) |
Tick the physics simulation.
Internally this runs multiple fixed time steps until the full dt has been ticked through.
| DtVector makVrv::DtRk4MotionModel::velocity | ( | ) | const |
Get the object's linear velocity in world coordinates.
| DtVector makVrv::DtRk4MotionModel::position | ( | ) | const |
Get the object's position in world coordinates.
| DtTaitBryan makVrv::DtRk4MotionModel::orientation | ( | ) | const |
Get the object's orientation in world coordinates.
| void makVrv::DtRk4MotionModel::setPosition | ( | const DtVector & | position | ) |
Set the object's position in world coordinates.
| void makVrv::DtRk4MotionModel::setOrientation | ( | const DtTaitBryan & | orientation | ) |
Set the object's orientation in world coordinates.
| void makVrv::DtRk4MotionModel::setTargetOrientation | ( | const DtTaitBryan & | orientation | ) |
Set the resting orientation of the object in world coordinates.
| void makVrv::DtRk4MotionModel::setSpeed | ( | double | speed | ) |
Set the forward speed of the object.
This overwrites the current velocity
| void makVrv::DtRk4MotionModel::sink | ( | ) |
Start simulated sinking.
| void makVrv::DtRk4MotionModel::unsink | ( | ) |
Restore the object to the water surface.
| bool makVrv::DtRk4MotionModel::isSinking | ( | ) |
Returns whether the model is currently sinking.
| void makVrv::DtRk4MotionModel::setSinkingSpeedScale | ( | double | scale | ) |
Allow the user to vary the speed at which ships sink.
| double makVrv::DtRk4MotionModel::sinkingSpeedScale | ( | ) | const |
Get the current sinking speed scale.
Set roll and pitch inertia coefficients in entity local coordinates.
| void makVrv::DtRk4MotionModel::applyForce | ( | const DtVector & | offset, |
| const DtVector & | force | ||
| ) |
apply a force at offset (in entity coordinatess) for the next frame
| void makVrv::DtRk4MotionModel::applyHeadingTorque | ( | double | magnitude | ) |
Apply a torque around the up vector for the next frame.
| void makVrv::DtRk4MotionModel::applyRollTorque | ( | double | magnitude | ) |
Apply a torque around the forward vector for the next frame.
| void makVrv::DtRk4MotionModel::addBuoyancySample | ( | BuoyancySample * | bs | ) |
Add a buoyancy sample point to the simulated object.
| BuoyancySampleVec& makVrv::DtRk4MotionModel::buoyancySamples | ( | ) |
Get a list of the sample points.
| void makVrv::DtRk4MotionModel::setOrigin | ( | const DtVector & | pos | ) |
Set an origin point in world coordinates for the simulation to use for its topo coordinate system.
Use this only for initialization; to move the origin of a running simulation, use moveOrigin instead.
| DtVector makVrv::DtRk4MotionModel::origin | ( | ) | const |
Get the origin of the simulation's topo system in world coordinates.
| void makVrv::DtRk4MotionModel::moveOrigin | ( | const DtVector & | pos | ) |
Move the origin of the simulation's topo system to a new origin, in world coordinates.
|
private |
Convert local position offset into world position.
|
private |
Convert local pitch/roll offset into world orientation.
|
private |
Convert world position offset into local position.
|
private |
Convert world orientation into local hrp.
|
privatevirtual |
Update the cached coordinate converter.
|
private |
Compute the derivatives from the passed in motion state and initial derivatives, over time step dt.
|
private |
Compute the second derivatives for the passed in motion state over time step dt.
|
friend |
|
static |
time step for the motion model in seconds (currently 1/60 of a second)
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |