Momentum Scripting v1
Loading...
Searching...
No Matches
MOMENTUM_NAMESPACE::RigidBody Class Reference

#include <RigidBody.h>

Public Types

enum  MotionControl { STATIC = 1 , KINEMATICS = 2 , DYNAMICS = 3 }
 

Public Member Functions

void addForce (const Vec3 &force)
 
void addForce (double fx, double fy, double fz)
 
void addForceAtLocalCmPosition (const Vec3 &force, const Vec3 &position)
 
void addForceAtLocalCmPosition (double fx, double fy, double fz, double px, double py, double pz)
 
void addForceAtLocalPosition (const Vec3 &force, const Vec3 &position)
 
void addForceAtLocalPosition (double fx, double fy, double fz, double px, double py, double pz)
 
void addForceAtPosition (const Vec3 &force, const Vec3 &position)
 
void addForceAtPosition (double fx, double fy, double fz, double px, double py, double pz)
 
void addLocalTorque (const Vec3 &torque)
 
void addLocalTorque (double tx, double ty, double tz)
 
void addTorque (const Vec3 &torque)
 
void addTorque (double tx, double ty, double tz)
 
agx::RigidBody * body () const
 
Vec3 getAngularAcceleration () const
 
Vec3 getAngularMomentum () const
 
Vec3 getAngularVelocity () const
 
Vec3 getAngularVelocityDamping () const
 
Vec3 getCmLocalTranslate () const
 
Vec3 getCmPosition () const
 
AffineMatrix4x4 getCmTransform () const
 
ContactPointVector getContacts () const
 
bool getEnable () const
 
Vec3 getForce () const
 
GeometryVector getGeometries () const
 
Matrix3x3 getInertia ()
 
Vec3 getLastForce () const
 
Vec3 getLastTorque () const
 
Vec3 getLinearAcceleration () const
 
Vec3 getLinearMomentum () const
 
Vec3 getLinearVelocity () const
 
Vec3 getLinearVelocityDamping () const
 
double getMass ()
 
Vec3 getModelAcceleration (const Vec3 &relPos=Vec3()) const
 
Vec3 getModelVelocity (const Vec3 &relPos=Vec3()) const
 
RigidBody::MotionControl getMotionControl () const
 
std::string getName () const
 
size_t getNumConstraints () const
 
Vec3 getPosition () const
 
Quat getRotation () const
 
double getRotationalEnergy () const
 
Vec3 getTorque () const
 
double getTotalEnergy () const
 
AffineMatrix4x4 getTransform () const
 
double getTranslationalEnergy () const
 
bool is (agx::RigidBody *body) const
 
bool isEmittedBody () const
 
void moveTo (const AffineMatrix4x4 &target, double t)
 
void moveTo (const Vec3 &targetPosition, const Quat &targetRotation, double dt)
 
bool operator== (const RigidBody &other) const
 
void setAngularVelocity (const Vec3 &angularVelocity)
 
void setAngularVelocity (double vx, double vy, double vz)
 
void setAngularVelocityDamping (const Vec3 &damping)
 
void setAngularVelocityDamping (double damping)
 
bool setCmAndInertiaInObserver (const Observer &observer, const Matrix3x3 &inertia)
 
void setCmLocalTranslate (const Vec3 &translate)
 
void setCmPosition (const Vec3 &p)
 
void setCmTransform (const AffineMatrix4x4 &matrix)
 
void setEnable (bool enable)
 
void setForce (const Vec3 &force)
 
void setForce (double fx, double fy, double fz)
 
bool setInertia (Matrix3x3 inertia)
 
void setLinearVelocity (const Vec3 &velocity)
 
void setLinearVelocity (double vx, double vy, double vz)
 
void setLinearVelocityDamping (const Vec3 &damping)
 
void setLinearVelocityDamping (double damping)
 
void setMass (double mass)
 
void setMotionControl (RigidBody::MotionControl control)
 
void setPosition (const Vec3 &p)
 
void setPosition (double x, double y, double z)
 
void setRotation (const EulerAngles *e)
 
void setRotation (const Quat &q)
 
void setTorque (const Vec3 &torque)
 
void setTorque (double tx, double ty, double tz)
 
void setTransform (const AffineMatrix4x4 &matrix)
 
void setVelocityDamping (double damping)
 

Detailed Description

A rigid body is a moving (translation/rotation) object with a mass and a inertia.

It can contain zero or more geometries.

Member Enumeration Documentation

◆ MotionControl

The MotionControl enumeration indicates what makes a RigidBody move.

There are three forms of motion allowed:

  • STATIC - The body has infinite mass and will not move;
  • KINEMATICS - The body has infinite mass and is only controlled by the velocity;
  • DYNAMICS - The body can be affected by forces
Enumerator
STATIC 

The body has infinite mass and will not move.

KINEMATICS 

The body has infinite mass and will not move.

(Position/velocity set by the user)

DYNAMICS 

The body can be affected by forces.

(Position/velocity updated by the system)

Member Function Documentation

◆ addForce() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::addForce ( const Vec3 force)

Adds the force, given in world coordinate system, that will be affecting this body in the next solve.

Parameters
force- the force, given in world coordinate system,

Only available in simulation mode

◆ addForce() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::addForce ( double  fx,
double  fy,
double  fz 
)

Adds the force, given in world coordinate system, that will be affecting this body in the next solve.

Parameters
fx,fy,fz- the force, given in world coordinate system,

Only available in simulation mode

◆ addForceAtLocalCmPosition() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::addForceAtLocalCmPosition ( const Vec3 force,
const Vec3 position 
)

Add a force, given in world coordinate system, applied at a position relative to the center of mass.

Whenever the position is different from (0,0,0), this method will also introduce a torque.

Parameters
force- the force, given in world coordinate system, to be added to the already previously added forces
position- the position in local center of mass coordinate system where the force should be applied

Only available in simulation mode

◆ addForceAtLocalCmPosition() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::addForceAtLocalCmPosition ( double  fx,
double  fy,
double  fz,
double  px,
double  py,
double  pz 
)

Add a force, given in world coordinate system, applied at a position relative to the center of mass.

Whenever the position is different from (0,0,0), this method will also introduce a torque.

Parameters
fx,fy,fz- the force, given in world coordinate system, to be added to the already previously added forces
px,py,pz- the position in local center of mass coordinate system where the force should be applied

Only available in simulation mode

◆ addForceAtLocalPosition() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::addForceAtLocalPosition ( const Vec3 force,
const Vec3 position 
)

Add a force, given in world coordinate system, applied at a position given in local rigid body coordinate system.

If the position is different from the center of mass, a torque will be calculated and added as well.

Parameters
force- the force, given in world coordinate system, to be added to the already previously added forces
position- the position given in local coordinate system where the force should be applied

Only available in simulation mode

◆ addForceAtLocalPosition() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::addForceAtLocalPosition ( double  fx,
double  fy,
double  fz,
double  px,
double  py,
double  pz 
)

Add a force, given in world coordinate system, applied at a position given in local rigid body coordinate system.

If the position is different from the center of mass, a torque will be calculated and added as well.

Parameters
fx,fy,fz- the force, given in world coordinate system, to be added to the already previously added forces
px,py,pz- the position given in local coordinate system where the force should be applied

Only available in simulation mode

◆ addForceAtPosition() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::addForceAtPosition ( const Vec3 force,
const Vec3 position 
)

Add a force, given in world coordinate system, applied at a position given in world coordinate system.

If the position is different from the center of mass, a torque will be calculated and added as well.

Parameters
force- the force, given in world coordinate system, to be added to the already previously added forces
position- the position given in world coordinate system where the force should be applied

Only available in simulation mode

◆ addForceAtPosition() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::addForceAtPosition ( double  fx,
double  fy,
double  fz,
double  px,
double  py,
double  pz 
)

Add a force, given in world coordinate system, applied at a position given in world coordinate system.

If the position is different from the center of mass, a torque will be calculated and added as well.

Parameters
fx,fy,fz- the force, given in world coordinate system, to be added to the already previously added forces
px,py,pz- the position given in world coordinate system where the force should be applied

Only available in simulation mode

◆ addLocalTorque() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::addLocalTorque ( const Vec3 torque)

Adds the torque, given in local coordinate system, that will be affecting this body in the next solve.

Parameters
torque- the torque

Only available in simulation mode

◆ addLocalTorque() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::addLocalTorque ( double  tx,
double  ty,
double  tz 
)

Adds the torque, given in local coordinate system, that will be affecting this body in the next solve.

Parameters
tx,ty,tz- the torque, given in local coordinate system

Only available in simulation mode

◆ addTorque() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::addTorque ( const Vec3 torque)

Adds the torque, given in world coordinate system, that will be affecting this body in the next solve.

Parameters
torque- the torque, given in world coordinate system

Only available in simulation mode

◆ addTorque() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::addTorque ( double  tx,
double  ty,
double  tz 
)

Adds the torque, given in world coordinate system, that will be affecting this body in the next solve.

Parameters
tx,ty,tz- the torque, given in world coordinate system

Only available in simulation mode

◆ body()

agx::RigidBody * MOMENTUM_NAMESPACE::RigidBody::body ( ) const
Returns
the agx::RigidBody body instance in the model.

◆ getAngularAcceleration()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getAngularAcceleration ( ) const

Will always be 0 for KINEMATIC and STATIC bodies.

Returns
the angular acceleration as the difference in linear velocity between this and the previous time step

◆ getAngularMomentum()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getAngularMomentum ( ) const
Returns
the angular momentum for this body

◆ getAngularVelocity()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getAngularVelocity ( ) const

Angular velocity in world coordinate system.

Note
Angular velocity is independent of the point it is measured in. I.e., methods like getModelAngularVelocity are redundant.
Returns
angular velocity in world coordinate system

◆ getAngularVelocityDamping()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getAngularVelocityDamping ( ) const
Returns
the linear velocity damping, given in local body coordinate system

◆ getCmLocalTranslate()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getCmLocalTranslate ( ) const
Returns
the local offset of the center of mass position to the rigid body origin (in the local rigid body coordinate system).

◆ getCmPosition()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getCmPosition ( ) const
Returns
the center of mass position in world coordinate system

◆ getCmTransform()

AffineMatrix4x4 MOMENTUM_NAMESPACE::RigidBody::getCmTransform ( ) const
Returns
the center of mass transform in world coordinate system

◆ getContacts()

ContactPointVector MOMENTUM_NAMESPACE::RigidBody::getContacts ( ) const

Get all contacts in which this rigid body is involved.

Returns
vector with all contacts involving this rigid body

◆ getEnable()

bool MOMENTUM_NAMESPACE::RigidBody::getEnable ( ) const

Access the state enable flag.

Returns
true if the body is enabled (default) - otherwise false

◆ getForce()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getForce ( ) const
Returns
the current external force applied to the body using the method(s) add/setForce

◆ getGeometries()

GeometryVector MOMENTUM_NAMESPACE::RigidBody::getGeometries ( ) const

Get all geometries of the rigid body.

Returns
a list of all geometries under the rigid body

◆ getInertia()

Matrix3x3 MOMENTUM_NAMESPACE::RigidBody::getInertia ( )

Get the inertia of the rigid body in the specified coordinate system.

Parameters
framethe frame in which to read the inertia
Returns
the inertia of the body

◆ getLastForce()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getLastForce ( ) const

Access the summed force applied to this rigid body last time the system was integrated.

See also
addForce, addForceAtPosition
Note
Forces applied by constraints and/or contacts are NOT included in this value.

◆ getLastTorque()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getLastTorque ( ) const

Access the summed torque applied to this rigid body last time the system was integrated.

See also
addTorque
Note
Torques applied by constraints and/or contacts are NOT included in this value.

◆ getLinearAcceleration()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getLinearAcceleration ( ) const

Will always be 0 for KINEMATIC and STATIC bodies.

Returns
the linear acceleration as the difference in linear velocity between this and the previous time step

◆ getLinearMomentum()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getLinearMomentum ( ) const
Returns
the linear momentum for this body

◆ getLinearVelocity()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getLinearVelocity ( ) const

Velocity of center of mass in world coordinate system.

See also
getModelVelocity
Returns
linear velocity of the center of mass frame origin, in world coordinate system

◆ getLinearVelocityDamping()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getLinearVelocityDamping ( ) const
Returns
the linear velocity damping, given in local body coordinate system

◆ getMass()

double MOMENTUM_NAMESPACE::RigidBody::getMass ( )

Get the mass of the rigid body in kilograms.

Returns
the mass of the body

◆ getModelAcceleration()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getModelAcceleration ( const Vec3 relPos = Vec3()) const

Calculates the linear acceleration at the given point relPos.

The point relPos must be given in model coordinate system. The resulting linear acceleration is given in world coordinate system.

See also
getAcceleration, getModelVelocity
Parameters
relPos- relative position given in model frame coordinates
Returns
linear acceleration in world frame of the point relPos

◆ getModelVelocity()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getModelVelocity ( const Vec3 relPos = Vec3()) const

Calculates the linear velocity at the given point relPos.

The point relPos must be given in model coordinate system. The resulting linear velocity is given in world coordinate system.

See also
getModelAcceleration, getVelocity
Parameters
relPos- relative position given in model frame coordinates
Returns
linear velocity in world frame of the point relPos

◆ getMotionControl()

RigidBody::MotionControl MOMENTUM_NAMESPACE::RigidBody::getMotionControl ( ) const
Returns
the motion control state of this rigid body

◆ getName()

std::string MOMENTUM_NAMESPACE::RigidBody::getName ( ) const
Returns
the name of this rigid body

◆ getNumConstraints()

size_t MOMENTUM_NAMESPACE::RigidBody::getNumConstraints ( ) const
Returns
the number of constraints (contacts excluded) connected to this rigid body

◆ getPosition()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getPosition ( ) const

Current rigid body position, given in world coordinate system.

Returns
the current rigid body frame position, given in world coordinate system

◆ getRotation()

Quat MOMENTUM_NAMESPACE::RigidBody::getRotation ( ) const

Current rigid body rotation, given in world coordinate system.

Returns
the current rigid body rotation, given in world coordinate system

◆ getRotationalEnergy()

double MOMENTUM_NAMESPACE::RigidBody::getRotationalEnergy ( ) const
Returns
the rotational energy for this body

◆ getTorque()

Vec3 MOMENTUM_NAMESPACE::RigidBody::getTorque ( ) const
Returns
the current external torque applied to the body using the method(s) add/setTorque

◆ getTotalEnergy()

double MOMENTUM_NAMESPACE::RigidBody::getTotalEnergy ( ) const
Returns
the total energy for this body

◆ getTransform()

AffineMatrix4x4 MOMENTUM_NAMESPACE::RigidBody::getTransform ( ) const

Current rigid body transformation, given in world coordinate system.

Returns
the current transformation of this rigid body, given in world coordinate system

◆ getTranslationalEnergy()

double MOMENTUM_NAMESPACE::RigidBody::getTranslationalEnergy ( ) const
Returns
the translational energy for this body

◆ is()

bool MOMENTUM_NAMESPACE::RigidBody::is ( agx::RigidBody *  body) const

Check if this a representation of the specified agx::RigidBody.

Parameters
bodythe body to check
Returns
true if this is a wrapper for body

◆ isEmittedBody()

bool MOMENTUM_NAMESPACE::RigidBody::isEmittedBody ( ) const
Returns
true if the rigid body has been created from an emitter, false otherwise.

◆ moveTo() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::moveTo ( const AffineMatrix4x4 target,
double  t 
)

Utility method to calculate and assign linear- and angular velocity given a target transform and the time it should take to get there.

This is basically only valid if motion control is set to KINEMATICS.

Note
This method only calculates a velocity required to reach the target transform with time t. The rigid body will not stop at target transform after time t.
Parameters
target- target transform given in world coordinate system
t- time this rigid body has to reach the target

Only available in simulation mode

◆ moveTo() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::moveTo ( const Vec3 targetPosition,
const Quat targetRotation,
double  dt 
)

Utility method to calculate and assign linear- and angular velocity given a target transform and the time it should take to get there.

This is basically only valid if motion control is set to KINEMATICS.

Note
This method only calculates a velocity required to reach the target transform with time t. The rigid body will not stop at target transform after time t.
Parameters
targetPosition- target position given in world coordinate system
targetRotation- target rotation given in world coordinate system
t- time this rigid body has to reach the target

Only available in simulation mode

◆ operator==()

bool MOMENTUM_NAMESPACE::RigidBody::operator== ( const RigidBody other) const

◆ setAngularVelocity() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setAngularVelocity ( const Vec3 angularVelocity)

Set the angular velocity of the center of mass of this rigid body.

This is the preferred way of moving KINEMATIC rigid bodies (a more convenient way is using moveTo(...)). The use for DYNAMIC is discouraged except for setting an initial angular velocity. If motion control is set to STATIC then the angular velocity will be set to zero - independent of the value of angularVelocity. This method is seen as an instantaneous change in angular velocity (infinite acceleration), and will therefore not be represented by getAngularAcceleration().

Parameters
angularVelocity- angular velocity given in world coordinate system

Only available in simulation mode

◆ setAngularVelocity() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setAngularVelocity ( double  vx,
double  vy,
double  vz 
)

Set the angular velocity of the center of mass of this rigid body.

This is the preferred way of moving KINEMATIC rigid bodies (a more convenient way is using moveTo(...)). The use for DYNAMIC is discouraged except for setting an initial angular velocity. If motion control is set to STATIC then the angular velocity will be set to zero - independent of the value of angularVelocity. This method is seen as an instantaneous change in angular velocity (infinite acceleration), and will therefore not be represented by getAngularAcceleration().

Parameters
vx,vy,vz- angular velocity given in world coordinate system

Only available in simulation mode

◆ setAngularVelocityDamping() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setAngularVelocityDamping ( const Vec3 damping)

Give angular velocity damping in each direction, given in local body coordinate system.

The unit of this damping is mass over time. Default: (0, 0, 0) (no damping).

Parameters
damping- the damping

Only available in simulation mode

◆ setAngularVelocityDamping() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setAngularVelocityDamping ( double  damping)

Set angular velocity damping for the body in all directions x, y and z.

The unit of this damping is mass over time. Default: 0 (no damping)

Parameters
damping- the damping

Only available in simulation mode

◆ setCmAndInertiaInObserver()

bool MOMENTUM_NAMESPACE::RigidBody::setCmAndInertiaInObserver ( const Observer observer,
const Matrix3x3 inertia 
)

Assign a new center of mass and inertia tensor using an observer.

The center of mass is set to the location of the Observer, and the inertia is specified in the frame of the Observer.

Parameters
observerthe observer to set the cm to and base the inertia on
inertiathe new inertia of the body in the frame of the observer

Only availible in simulation mode

◆ setCmLocalTranslate()

void MOMENTUM_NAMESPACE::RigidBody::setCmLocalTranslate ( const Vec3 translate)

Sets the local offset of the center of mass position to the model origin (in the local rigid body coordinate system).

Parameters
translateThe new offset.

Only available in simulation mode

◆ setCmPosition()

void MOMENTUM_NAMESPACE::RigidBody::setCmPosition ( const Vec3 p)

Assign new center of mass position, given in world coordinate frame.

By default the rigid body position will be updated as well (synchronizeModel).

Parameters
matrix- new center of mass position given in world coordinate system
synchronizeModel- default true, if false the rigid body positition will not be updated with this new position

Only available in simulation mode

◆ setCmTransform()

void MOMENTUM_NAMESPACE::RigidBody::setCmTransform ( const AffineMatrix4x4 matrix)

Assign new center of mass transform, given in world coordinate frame.

By default the model frame will be updated as well (synchronizeModel).

Note
The center of mass frame MUST, by definition, have the same orientation as the model frame. I.e., it is not defined to call this method with synchronizeModel = false and matrix having a different rotation than the model frame matrix.
Parameters
matrix- new matrix transform given in world coordinate system
synchronizeModel- default true, if false the model frame will not be updated with this new transform.

Only available in simulation mode

◆ setEnable()

void MOMENTUM_NAMESPACE::RigidBody::setEnable ( bool  enable)

Change state enable of this rigid body.

Default: true.

Parameters
enable- true to enable, false to disable

Only available in simulation mode

◆ setForce() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setForce ( const Vec3 force)

Explicitly set the force, given in world coordinate system, that will be affecting this body in the next solve.

Note
Force added before calling this method will be overwritten. Force added after calling this method will be added to force.
Parameters
force- the force

Only available in simulation mode

◆ setForce() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setForce ( double  fx,
double  fy,
double  fz 
)

Explicitly set the force, given in world coordinate system, that will be affecting this body in the next solve.

Note
Force added before calling this method will be overwritten. Force added after calling this method will be added to force.
Parameters
fx,fy,fz- the force

Only available in simulation mode

◆ setInertia()

bool MOMENTUM_NAMESPACE::RigidBody::setInertia ( Matrix3x3  inertia)

Set the inertia of the rigid body in the specified coordinate system.

Parameters
inertiathe inertia matrix to set.
framethe frame in which to write the inertia
Returns
true if valid inertia, otherwise false

◆ setLinearVelocity() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setLinearVelocity ( const Vec3 velocity)

Set the linear velocity of the center of mass of this rigid body.

This is the preferred way of moving KINEMATIC rigid bodies (a more convenient way is using moveTo(...)). The use for DYNAMIC is discouraged except for setting an initial velocity. If motion control is set to STATIC then the linear velocity will be set to zero - independent of the value of velocity. This method is seen as an instantaneous change in velocity (infinite acceleration), and will therefore not be represented by getAcceleration().

Parameters
velocity- velocity given in world coordinate system

Only available in simulation mode

◆ setLinearVelocity() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setLinearVelocity ( double  vx,
double  vy,
double  vz 
)

Set the linear velocity of the center of mass of this rigid body.

This is the preferred way of moving KINEMATIC rigid bodies (a more convenient way is using moveTo(...)). The use for DYNAMIC is discouraged except for setting an initial velocity. If motion control is set to STATIC then the linear velocity will be set to zero - independent of the value of velocity. This method is seen as an instantaneous change in velocity (infinite acceleration), and will therefore not be represented by getAcceleration().

Parameters
vx,vy,vz- velocity given in world coordinate system

Only available in simulation mode

◆ setLinearVelocityDamping() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setLinearVelocityDamping ( const Vec3 damping)

Give linear velocity damping in each direction, given in local body coordinate system.

The unit of this damping is mass over time. Default: (0, 0, 0) (no damping).

Parameters
damping- the damping

Only available in simulation mode

◆ setLinearVelocityDamping() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setLinearVelocityDamping ( double  damping)

Set linear velocity damping for the body in all directions x, y and z.

The unit of this damping is mass over time. Default: 0 (no damping)

Parameters
damping- the damping

Only available in simulation mode

◆ setMass()

void MOMENTUM_NAMESPACE::RigidBody::setMass ( double  mass)

Set the mass of the rigid body in kilograms.

Parameters
massthe new mass

Only available in simulation mode

◆ setMotionControl()

void MOMENTUM_NAMESPACE::RigidBody::setMotionControl ( RigidBody::MotionControl  control)

Assign new motion control state to this rigid body.

If new state is STATIC - linear- and angular velocity will be set to zero. Default: DYNAMICS

Parameters
control- new motion control

Only available in simulation mode

◆ setPosition() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setPosition ( const Vec3 p)

Set the position of the model frame in world coordinate system.

Parameters
p- desired position in world coordinate system.

Only available in simulation mode

◆ setPosition() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setPosition ( double  x,
double  y,
double  z 
)

Set the position of the model frame in world coordinate system.

Parameters
x- desired x-coordinate in world coordinate system
y- desired y-coordinate in world coordinate system
z- desired z-coordinate in world coordinate system

Only available in simulation mode

◆ setRotation() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setRotation ( const EulerAngles e)

Set the rotation of the body relative to world coordinate system.

Parameters
e- rotation given as Euler angles

Only available in simulation mode

◆ setRotation() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setRotation ( const Quat q)

Set the rotation of the body relative to world coordinate system.

Parameters
q- rotation given as a quaternion

Only available in simulation mode

◆ setTorque() [1/2]

void MOMENTUM_NAMESPACE::RigidBody::setTorque ( const Vec3 torque)

Explicitly set the torque, given in world coordinate system, that will be affecting this body in the next solve.

Note
Torque added before calling this method will be overwritten. Torque added after calling this method will be added to torque.
Parameters
torque- the torque

Only available in simulation mode

◆ setTorque() [2/2]

void MOMENTUM_NAMESPACE::RigidBody::setTorque ( double  tx,
double  ty,
double  tz 
)

Explicitly set the torque, given in world coordinate system, that will be affecting this body in the next solve.

Note
Torque added before calling this method will be overwritten. Torque added after calling this method will be added to torque.
Parameters
tx,ty,tz- the torque

Only available in simulation mode

◆ setTransform()

void MOMENTUM_NAMESPACE::RigidBody::setTransform ( const AffineMatrix4x4 matrix)

Set the transformation of the body in world coordinate system.

Parameters
matrix- desired transform for the model frame in world coordinates.

Only available in simulation mode

◆ setVelocityDamping()

void MOMENTUM_NAMESPACE::RigidBody::setVelocityDamping ( double  damping)

Set both linear- and angular velocity damping in all directions.

See also
setLinearVelocityDamping, setAngularVelocityDamping
Parameters
damping- the damping

Only available in simulation mode