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

#include <GranularBody.h>

Public Types

enum  MotionControl { KINEMATICS = 2 , DYNAMICS = 3 }
 

Public Member Functions

 GranularBody ()
 
 GranularBody (agx::Physics::GranularBodyPtr)
 
void addForce (const Vec3 &force)
 
void addForce (double fx, double fy, double fz)
 
void addTorque (const Vec3 &torque)
 
void addTorque (double tx, double ty, double tz)
 
void destroy ()
 
Vec3 getAngularVelocity () const
 
Vec4 getColor () const
 
Vec3 getForce () const
 
unsigned int getId () const
 
double getMass () const
 
MaterialgetMaterial () const
 
GranularBody::MotionControl getMotionControl () const
 
Vec3 getPosition () const
 
double getRadius () const
 
Quat getRotation () const
 
Vec3 getVelocity () const
 
bool is (agx::Physics::GranularBodyPtr granularBody) const
 
bool isValid () const
 
bool operator== (const GranularBody &other) const
 
agx::Physics::GranularBodyPtr ptr () const
 
void setAngularVelocity (const Vec3 &angularVelocity)
 
void setAngularVelocity (double ax, double ay, double az)
 
void setColor (const Vec4 &color)
 
void setForce (const Vec3 &force)
 
void setForce (double fx, double fy, double fz)
 
void setLinearVelocity (const Vec3 &velocity)
 
void setLinearVelocity (double vx, double vy, double vz)
 
void setMass (double mass)
 
void setMaterial (const Material *material)
 
void setMotionControl (GranularBody::MotionControl motionControl)
 
void setPosition (const Vec3 &position)
 
void setPosition (double x, double y, double z)
 
void setRadius (double radius)
 
void setRotation (const EulerAngles &e)
 
void setRotation (const Quat &q)
 
void setTorque (const Vec3 &torque)
 
void setTorque (double tx, double ty, double tz)
 
void setVelocity (const Vec3 &velocity)
 
void setVelocity (double vx, double vy, double vz)
 

Detailed Description

A GranularBody class, representing a 6DOF spherical object that interacts with the environment trough hertzian contacts with coulomb friction and rolling resistance.

Member Enumeration Documentation

◆ MotionControl

There are two forms of motion allowed : -KINEMATICS means that motion is scripted; -DYNAMICS means that motion results from forces;.

Enumerator
KINEMATICS 

This Granular Body's motion is scripted.

(Position/velocity set by the user)

DYNAMICS 

This Granular Body moves from the influence of forces.

(Position/velocity updated by the system)

Constructor & Destructor Documentation

◆ GranularBody() [1/2]

MOMENTUM_NAMESPACE::GranularBody::GranularBody ( agx::Physics::GranularBodyPtr  )

Create a wrapper around an agx::Physics::GranularBodyPtr.

◆ GranularBody() [2/2]

MOMENTUM_NAMESPACE::GranularBody::GranularBody ( )

Null-constructor.

Member Function Documentation

◆ addForce() [1/2]

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

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

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

Only available in simulation mode.

◆ addForce() [2/2]

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

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

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

Only available in simulation mode.

◆ addTorque() [1/2]

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

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

Parameters
torque- the torque, given in world coordinate frame

Only available in simulation mode.

◆ addTorque() [2/2]

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

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

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

Only available in simulation mode.

◆ destroy()

void MOMENTUM_NAMESPACE::GranularBody::destroy ( )

Tag the GranularBody for destruction at the end of the timestep.

Will make the GranularBody non-valid.

Note
This will cause the GranularBody to return false during isValid() calls.

Only available in simulation mode.

◆ getAngularVelocity()

Vec3 MOMENTUM_NAMESPACE::GranularBody::getAngularVelocity ( ) const

Returns the current world angular velocity of the GranularBody.

Returns
The current world angular velocity of the GranularBody.

◆ getColor()

Vec4 MOMENTUM_NAMESPACE::GranularBody::getColor ( ) const

Get the color that will be used during rendering of the GranularBody.

Returns
the rendering color on the GranularBody.

◆ getForce()

Vec3 MOMENTUM_NAMESPACE::GranularBody::getForce ( ) const

Gets the current active force on the GranularBody that will be active during the next simulation step.

Returns
the current active force on the GranularBody that will be active during the next simulation step.

◆ getId()

unsigned int MOMENTUM_NAMESPACE::GranularBody::getId ( ) const

Gets the unique identifier id for the GranularBody.

Returns
the unique identifier id for the GranularBody.

◆ getMass()

double MOMENTUM_NAMESPACE::GranularBody::getMass ( ) const

Gets the mass of the GranularBody.

Returns
the mass of the GranularBody

◆ getMaterial()

Material * MOMENTUM_NAMESPACE::GranularBody::getMaterial ( ) const

Gets the active material on the GranularBody.

Returns
the material of the GranularBody

◆ getMotionControl()

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

◆ getPosition()

Vec3 MOMENTUM_NAMESPACE::GranularBody::getPosition ( ) const

Returns the current world position of the GranularBody.

Returns
The current world position of the GranularBody.

◆ getRadius()

double MOMENTUM_NAMESPACE::GranularBody::getRadius ( ) const

Gets the radius of the GranularBody.

Returns
the radius of the GranularBody

◆ getRotation()

Quat MOMENTUM_NAMESPACE::GranularBody::getRotation ( ) const

Returns the current world orientation of the GranularBody.

Returns
The current world orientation of the GranularBody.

◆ getVelocity()

Vec3 MOMENTUM_NAMESPACE::GranularBody::getVelocity ( ) const

Returns the current world velocity of the GranularBody.

Returns
The current world velocity of the GranularBody.

◆ is()

bool MOMENTUM_NAMESPACE::GranularBody::is ( agx::Physics::GranularBodyPtr  granularBody) const

◆ isValid()

bool MOMENTUM_NAMESPACE::GranularBody::isValid ( ) const

Gets true/false if the active GranularBody is valid or not.

Will return false if the GranularBody has been removed from the simulation.

Returns
true/false if the GranularBody is valid, i.e removed from the simulation.

◆ operator==()

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

◆ ptr()

agx::Physics::GranularBodyPtr MOMENTUM_NAMESPACE::GranularBody::ptr ( ) const

◆ setAngularVelocity() [1/2]

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

Set the world angular velocity of the GranularBody.

Parameters
angularVelocity- angular velocity around the respective world axis ( x, y ,z ) to set on the GranularBody.

Only available in simulation mode.

◆ setAngularVelocity() [2/2]

void MOMENTUM_NAMESPACE::GranularBody::setAngularVelocity ( double  ax,
double  ay,
double  az 
)

Set the world angular velocity of the GranularBody.

Parameters
ax- the angular velocity around the world x-axis to set.
ay- the angular velocity around the world y-axis to set.
az- the angular velocity around the world z-axis to set.

Only available in simulation mode.

◆ setColor()

void MOMENTUM_NAMESPACE::GranularBody::setColor ( const Vec4 color)

Set the color that will be used during rendering of the GranularBody.

Parameters
colorThe color that should be set on the GranularBody

Only available in simulation mode.

◆ setForce() [1/2]

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

Explicitly set the force, given in world coordinate frame, that will be affecting this GranularBody 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::GranularBody::setForce ( double  fx,
double  fy,
double  fz 
)

Explicitly set the force, given in world coordinate frame, that will be affecting this GranularBody 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.

◆ setLinearVelocity() [1/2]

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

Set the world linear velocity of the GranularBody.

Parameters
velocity- the desired world linear velocity to set on the GranularBody.

Only available in simulation mode.

◆ setLinearVelocity() [2/2]

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

Set the world linear velocity of the GranularBody.

Parameters
vx- the linear velocity in the world x-axis to set.
vy- the linear velocity in the world y-axis to set.
vz- the linear velocity in the world z-axis to set.

Only available in simulation mode.

◆ setMass()

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

Explicitly set the mass of the GranularBody.

Note
this will override the mass set to the body from the material density. When a new material is set, this mass will be overridden by the specified material density.
Parameters
massthe mass to set on the GranularBody

Only available in simulation mode.

◆ setMaterial()

void MOMENTUM_NAMESPACE::GranularBody::setMaterial ( const Material material)

Set the material on the GranularBody.

Note
This will update the mass of the GranularBody from the material density.
Parameters
massthe mass to set on the GranularBody

Only available in simulation mode.

◆ setMotionControl()

void MOMENTUM_NAMESPACE::GranularBody::setMotionControl ( GranularBody::MotionControl  motionControl)

Assign new motion control state to this granular body.

If new state is KINEMATICS - the body will have infinite mass and only move from user velocity/position input. Default: DYNAMICS

Parameters
control- new motion control

Only available in simulation mode

◆ setPosition() [1/2]

void MOMENTUM_NAMESPACE::GranularBody::setPosition ( const Vec3 position)

Set the world position of the GranularBody.

Parameters
positionthe desired position to set on the GranularBody.

Only available in simulation mode.

◆ setPosition() [2/2]

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

Set the world position of the GranularBody.

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

Only available in simulation mode.

◆ setRadius()

void MOMENTUM_NAMESPACE::GranularBody::setRadius ( double  radius)

Explicitly set the radius of the GranularBody.

Note
the mass of the GranularBody will be automatically updated from the body material density
Parameters
radiusthe radius to set on the GranularBody

Only available in simulation mode.

◆ setRotation() [1/2]

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

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

Parameters
e- rotation given as Euler angles

Only available in simulation mode

◆ setRotation() [2/2]

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

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

Parameters
q- rotation given as a quaternion

Only available in simulation mode

◆ setTorque() [1/2]

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

Explicitly set the torque, given in world coordinate frame, that will be affecting this GranularBody 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::GranularBody::setTorque ( double  tx,
double  ty,
double  tz 
)

Explicitly set the torque, given in world coordinate frame, that will be affecting this GranularBody 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.

◆ setVelocity() [1/2]

void MOMENTUM_NAMESPACE::GranularBody::setVelocity ( const Vec3 velocity)

◆ setVelocity() [2/2]

void MOMENTUM_NAMESPACE::GranularBody::setVelocity ( double  vx,
double  vy,
double  vz 
)