MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ApplySpeed

Method ApplySpeed

engine/Poseidon/World/Simulation/Simul.cpp:509–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509void Entity::ApplySpeed(Matrix4& result, float deltaT)
510{
511 Vector3 position = Position();
512 position += _speed * deltaT;
513 // rotate around the center of mass: translate COM to origin, rotate, translate back
514 Vector3Val com = GetCenterOfMass();
515 Matrix3 orientation = Orientation();
516 Vector3Val translateCOM = orientation * com;
517 orientation += _angVelocity.Tilda() * orientation * deltaT;
518 orientation.Orthogonalize();
519 Vector3 backCOM = orientation * com;
520 position += translateCOM - backCOM;
521
522 result.SetPosition(position);
523 result.SetOrientation(orientation);
524}
525
526void Entity::OnAddImpulse(Vector3Par force, Vector3Par torque) {}
527

Callers

nothing calls this directly

Calls 5

GetCenterOfMassFunction · 0.85
TildaMethod · 0.45
OrthogonalizeMethod · 0.45
SetPositionMethod · 0.45
SetOrientationMethod · 0.45

Tested by

no test coverage detected