The IBody graph node interface. More...

#include "murl_graph_i_body.h"

Inheritance diagram for Murl::Graph::IBody:

Public Member Functions

virtual INodeGetNodeInterface ()=0
 Get the mutable Graph::INode interface. More...
 
virtual const INodeGetNodeInterface () const =0
 Get the constant Graph::INode interface. More...
 
virtual ITransformGetTransformInterface ()=0
 Get the mutable Graph::ITransform interface. More...
 
virtual const ITransformGetTransformInterface () const =0
 Get the constant Graph::ITransform interface. More...
 
virtual Bool SetTriggerGroupMask (UInt32 mask)=0
 Set the active collision trigger groups for this body. More...
 
virtual UInt32 GetTriggerGroupMask () const =0
 Get the active collision trigger groups for this body. More...
 
virtual Bool SetResponseGroupMask (UInt32 mask)=0
 Set the active response groups for this body. More...
 
virtual UInt32 GetResponseGroupMask () const =0
 Get the active response groups for this body. More...
 
virtual Bool SetMass (Real mass)=0
 Set the body's mass. More...
 
virtual Real GetMass () const =0
 Get the body's mass. More...
 
virtual Bool SetInverseMass (Real inverseMass)=0
 Set the body's inverse mass. More...
 
virtual Real GetInverseMass () const =0
 Get the body's inverse mass. More...
 
virtual Bool SetDragCoefficient (Real value)=0
 Set the body's drag coefficient (aka "cw" or "cd" value). More...
 
virtual Real GetDragCoefficient () const =0
 Get the body's drag coefficient. More...
 
virtual Bool SetSize (const Vector &size)=0
 Set the physical size of the body. More...
 
virtual const VectorGetSize () const =0
 Get the body's physical size. More...
 
virtual Bool SetForceEffectEnabled (Bool enabled)=0
 Enable/disable force effects on this body. More...
 
virtual Bool IsForceEffectEnabled () const =0
 Check if force effect is enabled. More...
 
virtual Bool SetTorqueEffectEnabled (Bool enabled)=0
 Enable/disable torque effects on this body. More...
 
virtual Bool IsTorqueEffectEnabled () const =0
 Check if torque effect is enabled. More...
 
virtual Bool SetCollisionEffectEnabled (Bool enabled)=0
 Enable/disable collision effect on this body. More...
 
virtual Bool IsCollisionEffectEnabled () const =0
 Check if collision effect is enabled. More...
 
virtual Bool SetCollisionReportingEnabled (Bool enabled)=0
 Enable/disable collision reporting on this body. More...
 
virtual Bool IsCollisionReportingEnabled () const =0
 Check if collision reporting is enabled. More...
 
virtual void ApplyRelativeForceAndTorqueAtRelativePoint (const Vector &p, const Vector &f)=0
 Apply both force and torque, given a relative force at a relative position. More...
 
virtual void ApplyAbsoluteForceAndTorqueAtRelativePoint (const Vector &p, const Vector &f)=0
 Apply both force and torque, given an absolute force at a relative position. More...
 
virtual void ApplyRelativeForceAndTorqueAtAbsolutePoint (const Vector &p, const Vector &f)=0
 Apply both force and torque, given a relative force at an absolute position. More...
 
virtual void ApplyAbsoluteForceAndTorqueAtAbsolutePoint (const Vector &p, const Vector &f)=0
 Apply both force and torque, given an absolute force at an absolute position. More...
 
virtual void ApplyRelativeForceAtRelativePoint (const Vector &p, const Vector &f)=0
 Apply force only, given a relative force at a relative position. More...
 
virtual void ApplyAbsoluteForceAtRelativePoint (const Vector &p, const Vector &f)=0
 Apply force only, given an absolute force at a relative position. More...
 
virtual void ApplyRelativeForceAtAbsolutePoint (const Vector &p, const Vector &f)=0
 Apply force only, given a relative force at an absolute position. More...
 
virtual void ApplyAbsoluteForceAtAbsolutePoint (const Vector &p, const Vector &f)=0
 Apply force only, given an absolute force at an absolute position. More...
 
virtual void ApplyRelativeTorqueAtRelativePoint (const Vector &p, const Vector &f)=0
 Apply torque only, given a relative force at a relative position. More...
 
virtual void ApplyAbsoluteTorqueAtRelativePoint (const Vector &p, const Vector &f)=0
 Apply torque only, given an absolute force at a relative position. More...
 
virtual void ApplyRelativeTorqueAtAbsolutePoint (const Vector &p, const Vector &f)=0
 Apply torque only, given a relative force at an absolute position. More...
 
virtual void ApplyAbsoluteTorqueAtAbsolutePoint (const Vector &p, const Vector &f)=0
 Apply torque only, given an absolute force at an absolute position. More...
 
virtual Vector GetLinearMomentum () const =0
 Get the currently acting linear momentum. More...
 
virtual Vector GetAngularMomentum () const =0
 Get the currently acting angular momentum. More...
 
virtual Vector GetLinearVelocity () const =0
 Get the body's current linear velocity. More...
 
virtual Vector GetAngularVelocity () const =0
 Get the body's current angular velocity. More...
 
virtual UInt32 GetNumberOfCollisions () const =0
 Get the number of individual collisions. More...
 
virtual const VectorGetCollisionWorldPoint (UInt32 collisionIndex) const =0
 Get the actual incidence point for a specific collision. More...
 
virtual const VectorGetCollisionWorldDirection (UInt32 collisionIndex) const =0
 Get the normal vector of the collision. More...
 
virtual Real GetCollisionDepth (UInt32 collisionIndex) const =0
 Get the depth of the collision along the collision's normal vector. More...
 
virtual IBodyGetCollisionBody (UInt32 collisionIndex, UInt32 bodyIndex) const =0
 Get a body involved in a specific collision. More...
 
virtual IColliderGetCollisionGeometry (UInt32 collisionIndex, UInt32 bodyIndex) const =0
 Get the actual collider of a body involved in a specific collision. More...
 
virtual UInt32 GetCollisionSurfaceIndex (UInt32 collisionIndex, UInt32 bodyIndex) const =0
 Get the surface index of a collision. More...
 
virtual IBodyGetCollisionPartner (UInt32 collisionIndex) const =0
 DEPRECATED: Get the partner of a specific collision. More...
 
virtual Vector ResolveCollisions (const IBody *partner, Real margin) const =0
 Resolve all collisions, optionally with a given partner only. More...
 
virtual const MatrixGetBodyTransform () const =0
 Get a constant reference to the body's current world transform matrix. More...
 
virtual MatrixGetBodyTransform ()=0
 Get a mutable reference to the body's current world transform matrix. More...
 
virtual UInt32 GetNumberOfStages () const =0
 Get the body's number of stages. More...
 
virtual Physics::IBody * GetPhysicsBodyObject (UInt32 stage) const =0
 Get the body's internal physics simulator object. More...
 

Detailed Description

The IBody graph node interface.

Body nodes are the basis for objects controlled by the framework's built-in physics engine. A body has several properties that affect how it behaves in the simulated environment, such as mass, friction coefficients, contact softness etc. In addition, to be able to react to collisions with other bodies, it needs to have one or more Graph::ICollider nodes attached, which can have different shapes like planes, spheres or generic triangle meshes.

To gain more control over which bodies can collide with other bodies, it is possible to define up to 32 individual body groups. Each body may belong to any number of these groups (including no group), regarding both triggering of and responding to pending collision events (See SetTriggerGroupMask() and SetResponseGroupMask(), respectively). These groups also determine a body's reaction to the influence of a Graph::IField.

See Graph::ICollidable to define a body's collision surface.
See Graph::IField to define fields acting on a body.

Member Function Documentation

◆ GetNodeInterface() [1/2]

virtual INode* Murl::Graph::IBody::GetNodeInterface ( )
pure virtual

Get the mutable Graph::INode interface.

This method returns a mutable pointer to the node's Graph::INode interface, to be able to query or modify common node properties such as active state, visibility or ID.

Returns
The mutable Graph::INode interface, or null if not available

◆ GetNodeInterface() [2/2]

virtual const INode* Murl::Graph::IBody::GetNodeInterface ( ) const
pure virtual

Get the constant Graph::INode interface.

This method returns a constant pointer to the node's Graph::INode interface, to be able to query common node properties such as active state, visibility or ID.

Returns
The constant Graph::INode interface, or null if not available

◆ GetTransformInterface() [1/2]

virtual ITransform* Murl::Graph::IBody::GetTransformInterface ( )
pure virtual

Get the mutable Graph::ITransform interface.

This method returns a mutable pointer to the node's Graph::ITransform interface, to be able to query or modify the node's transformation matrix and depth order.

Returns
The mutable Graph::ITransform interface, or null if not available

◆ GetTransformInterface() [2/2]

virtual const ITransform* Murl::Graph::IBody::GetTransformInterface ( ) const
pure virtual

Get the constant Graph::ITransform interface.

This method returns a constant pointer to the node's Graph::ITransform interface, to be able to query the node's transformation matrix and depth order.

Returns
The constant Graph::ITransform interface, or null if not available

◆ SetTriggerGroupMask()

virtual Bool Murl::Graph::IBody::SetTriggerGroupMask ( UInt32  mask)
pure virtual

Set the active collision trigger groups for this body.

The group assignment for triggering collisions is performed via a UInt32 bit mask (up to 32 simultaneous groups), any individual bit set in the given mask results in generating a collision event in the respective group (e.g. group #5 for bit 5).

Parameters
maskThe group assignment bit mask.
Returns
true if successful.

◆ GetTriggerGroupMask()

virtual UInt32 Murl::Graph::IBody::GetTriggerGroupMask ( ) const
pure virtual

Get the active collision trigger groups for this body.

Returns
The bit mask specifying active trigger groups.

◆ SetResponseGroupMask()

virtual Bool Murl::Graph::IBody::SetResponseGroupMask ( UInt32  mask)
pure virtual

Set the active response groups for this body.

The group assignment for responding to collisions and field influence is performed via a UInt32 bit mask (up to 32 simultaneous groups), any individual bit set in the given mask results in a response to a pending collision event or field influence in the respective group (e.g. group #5 for bit 5).

Parameters
maskThe group assignment bit mask.
Returns
true if successful.

◆ GetResponseGroupMask()

virtual UInt32 Murl::Graph::IBody::GetResponseGroupMask ( ) const
pure virtual

Get the active response groups for this body.

Returns
The bit mask specifying active response groups.

◆ SetMass()

virtual Bool Murl::Graph::IBody::SetMass ( Real  mass)
pure virtual

Set the body's mass.

This also affects the internal inverse mass value; therefore it is not possible to set different values for mass and inverse mass.

Parameters
massThe body's mass.
Returns
true if successful.

◆ GetMass()

virtual Real Murl::Graph::IBody::GetMass ( ) const
pure virtual

Get the body's mass.

Returns
The body's mass.

◆ SetInverseMass()

virtual Bool Murl::Graph::IBody::SetInverseMass ( Real  inverseMass)
pure virtual

Set the body's inverse mass.

To define VERY heavy bodies, it is possible to set the inverse mass to zero, which results in an infinite mass for this body. In that case, the body will not show any reaction on collision impacts from other (less heavy) bodies. This also affects the internal mass value; therefore it is not possible to set different values for mass and inverse mass.

Parameters
inverseMassThe body's inverse mass.
Returns
true if successful.

◆ GetInverseMass()

virtual Real Murl::Graph::IBody::GetInverseMass ( ) const
pure virtual

Get the body's inverse mass.

Returns
The body's inverse mass.

◆ SetDragCoefficient()

virtual Bool Murl::Graph::IBody::SetDragCoefficient ( Real  value)
pure virtual

Set the body's drag coefficient (aka "cw" or "cd" value).

Parameters
valueThe body's drag coefficient.
Returns
true if successful.

◆ GetDragCoefficient()

virtual Real Murl::Graph::IBody::GetDragCoefficient ( ) const
pure virtual

Get the body's drag coefficient.

Returns
The body's drag coefficient.

◆ SetSize()

virtual Bool Murl::Graph::IBody::SetSize ( const Vector size)
pure virtual

Set the physical size of the body.

This sets the actual physical size of the body, which is used internally to calculate things like inertia tensor etc. It may actually differ from the "real" size that is defined by the body's attached colliders.

Parameters
sizeA vector containing the body's size in X, Y and Z dimensions.
Returns
true if successful.

◆ GetSize()

virtual const Vector& Murl::Graph::IBody::GetSize ( ) const
pure virtual

Get the body's physical size.

Returns
A vector containing the body's size in X, Y and Z dimensions.

◆ SetForceEffectEnabled()

virtual Bool Murl::Graph::IBody::SetForceEffectEnabled ( Bool  enabled)
pure virtual

Enable/disable force effects on this body.

For certain special use cases, it may be desired to restrict the way a body reacts on external influences. When both force effect and torque effect (see SetTorqueEffectEnabled()) are enabled, the body reacts normally. When force effect is enabled and torque effect disabled, any applied off-center forces will result in a translation movement only. For disabled force effect and enabled torque effect, the result will be a rotational movement only.

Parameters
enabledIf true, force effect is enabled.
Returns
true if successful.

◆ IsForceEffectEnabled()

virtual Bool Murl::Graph::IBody::IsForceEffectEnabled ( ) const
pure virtual

Check if force effect is enabled.

Returns
true if enabled.

◆ SetTorqueEffectEnabled()

virtual Bool Murl::Graph::IBody::SetTorqueEffectEnabled ( Bool  enabled)
pure virtual

Enable/disable torque effects on this body.

See SetForceEffectEnabled() for details.

Parameters
enabledIf true, torque effect is enabled.
Returns
true if successful.

◆ IsTorqueEffectEnabled()

virtual Bool Murl::Graph::IBody::IsTorqueEffectEnabled ( ) const
pure virtual

Check if torque effect is enabled.

Returns
true if enabled.

◆ SetCollisionEffectEnabled()

virtual Bool Murl::Graph::IBody::SetCollisionEffectEnabled ( Bool  enabled)
pure virtual

Enable/disable collision effect on this body.

Parameters
enabledIf true, collision effect is enabled.
Returns
true if successful.

◆ IsCollisionEffectEnabled()

virtual Bool Murl::Graph::IBody::IsCollisionEffectEnabled ( ) const
pure virtual

Check if collision effect is enabled.

Returns
true if enabled.

◆ SetCollisionReportingEnabled()

virtual Bool Murl::Graph::IBody::SetCollisionReportingEnabled ( Bool  enabled)
pure virtual

Enable/disable collision reporting on this body.

Parameters
enabledIf true, collision reporting is enabled.
Returns
true if successful.

◆ IsCollisionReportingEnabled()

virtual Bool Murl::Graph::IBody::IsCollisionReportingEnabled ( ) const
pure virtual

Check if collision reporting is enabled.

Returns
true if enabled.

◆ ApplyRelativeForceAndTorqueAtRelativePoint()

virtual void Murl::Graph::IBody::ApplyRelativeForceAndTorqueAtRelativePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply both force and torque, given a relative force at a relative position.

The given input force vector is always relative to the untransformed body, e.g. for an untransformed aeroplane with its nose pointing towards the -Z axis, its cockpit towards the +Y axis and its right wing towards the +X axis, a force vector of (0,0,-1) will always produce forward thrust, regardless of the plane's actual orientation in world space. The given position vector specifies the actual point where that force is applied; this point is also relative to the untransformed body. If that point is not equal to (0,0,0), the result will not only be a positional movement of the body, but will also result in some torque value applied to the body, resulting in a spin. For the previous example, if the plane's up vector is along the +Y axis, a position vector of (0,1,0) will apply a torque forcing the plane's nose "down". See also ApplyAbsoluteForceAndTorqueAtRelativePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyAbsoluteForceAndTorqueAtRelativePoint()

virtual void Murl::Graph::IBody::ApplyAbsoluteForceAndTorqueAtRelativePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply both force and torque, given an absolute force at a relative position.

The given input force vector is absolute in world space. Taking the plane example from ApplyRelativeForceAndTorqueAtRelativePoint(), with the world's north direction towards -Z, east towards +X and increasing altitude towards +Y, applying a vector of (1,0,0) will always represent west wind (blowing from west to east) acting on the plane, regardless of its position and orientation in world space. The given position vector specifies the actual point where that force is applied; this point is relative to the untransformed body. If this vector equals (0,0,0), no torque will be applied, and the plane will simply be blown off its course, keeping its orientation. A vector of e.g. (0,0,-1) would result in a torque forcing the plane's nose towards the direction of the wind.

Parameters
pThe position vector relative to the untransformed body.
fThe absolute force direction in world space.

◆ ApplyRelativeForceAndTorqueAtAbsolutePoint()

virtual void Murl::Graph::IBody::ApplyRelativeForceAndTorqueAtAbsolutePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply both force and torque, given a relative force at an absolute position.

See also ApplyRelativeForceAndTorqueAtRelativePoint() and ApplyAbsoluteForceAndTorqueAtRelativePoint(). TODO: Find a nice example.

Parameters
pThe absolute position vector in world space.
fThe absolute force direction in world space.

◆ ApplyAbsoluteForceAndTorqueAtAbsolutePoint()

virtual void Murl::Graph::IBody::ApplyAbsoluteForceAndTorqueAtAbsolutePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply both force and torque, given an absolute force at an absolute position.

See also ApplyRelativeForceAndTorqueAtRelativePoint() and ApplyAbsoluteForceAndTorqueAtRelativePoint(). TODO: Find a nice example.

Parameters
pThe absolute position vector in world space.
fThe absolute force direction in world space.

◆ ApplyRelativeForceAtRelativePoint()

virtual void Murl::Graph::IBody::ApplyRelativeForceAtRelativePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply force only, given a relative force at a relative position.

This method only applies a force influence, without applying any torque. See also ApplyRelativeForceAndTorqueAtRelativePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyAbsoluteForceAtRelativePoint()

virtual void Murl::Graph::IBody::ApplyAbsoluteForceAtRelativePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply force only, given an absolute force at a relative position.

This method only applies a force influence, without applying any torque. See also ApplyAbsoluteForceAndTorqueAtRelativePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyRelativeForceAtAbsolutePoint()

virtual void Murl::Graph::IBody::ApplyRelativeForceAtAbsolutePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply force only, given a relative force at an absolute position.

This method only applies a force influence, without applying any torque. See also ApplyRelativeForceAndTorqueAtAbsolutePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyAbsoluteForceAtAbsolutePoint()

virtual void Murl::Graph::IBody::ApplyAbsoluteForceAtAbsolutePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply force only, given an absolute force at an absolute position.

This method only applies a force influence, without applying any torque. See also ApplyAbsoluteForceAndTorqueAtAbsolutePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyRelativeTorqueAtRelativePoint()

virtual void Murl::Graph::IBody::ApplyRelativeTorqueAtRelativePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply torque only, given a relative force at a relative position.

This method only applies a torque influence, without applying any force. See also ApplyRelativeForceAndTorqueAtRelativePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyAbsoluteTorqueAtRelativePoint()

virtual void Murl::Graph::IBody::ApplyAbsoluteTorqueAtRelativePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply torque only, given an absolute force at a relative position.

This method only applies a torque influence, without applying any force. See also ApplyAbsoluteForceAndTorqueAtRelativePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyRelativeTorqueAtAbsolutePoint()

virtual void Murl::Graph::IBody::ApplyRelativeTorqueAtAbsolutePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply torque only, given a relative force at an absolute position.

This method only applies a torque influence, without applying any force. See also ApplyRelativeForceAndTorqueAtAbsolutePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ ApplyAbsoluteTorqueAtAbsolutePoint()

virtual void Murl::Graph::IBody::ApplyAbsoluteTorqueAtAbsolutePoint ( const Vector p,
const Vector f 
)
pure virtual

Apply torque only, given an absolute force at an absolute position.

This method only applies a torque influence, without applying any force. See also ApplyAbsoluteForceAndTorqueAtAbsolutePoint().

Parameters
pThe position vector relative to the untransformed body.
fThe force direction vector relative to the untransformed body.

◆ GetLinearMomentum()

virtual Vector Murl::Graph::IBody::GetLinearMomentum ( ) const
pure virtual

Get the currently acting linear momentum.

Returns
A vector containing the current linear momentum.

◆ GetAngularMomentum()

virtual Vector Murl::Graph::IBody::GetAngularMomentum ( ) const
pure virtual

Get the currently acting angular momentum.

Returns
A vector containing the current angular momentum.

◆ GetLinearVelocity()

virtual Vector Murl::Graph::IBody::GetLinearVelocity ( ) const
pure virtual

Get the body's current linear velocity.

Returns
A vector containing the current linear velocity.

◆ GetAngularVelocity()

virtual Vector Murl::Graph::IBody::GetAngularVelocity ( ) const
pure virtual

Get the body's current angular velocity.

Returns
A vector containing the current angular velocity.

◆ GetNumberOfCollisions()

virtual UInt32 Murl::Graph::IBody::GetNumberOfCollisions ( ) const
pure virtual

Get the number of individual collisions.

This returns the total number of individual collisions that occurred during the last simulation step on the body. After each step, this number is reset to zero, and new collisions are evaluated.

Returns
The total number of individual collisions.

◆ GetCollisionWorldPoint()

virtual const Vector* Murl::Graph::IBody::GetCollisionWorldPoint ( UInt32  collisionIndex) const
pure virtual

Get the actual incidence point for a specific collision.

This returns the incidence point for a given collision in world coordinates.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
Returns
a constant pointer to the wold collision point, or null if the index was out of range.

◆ GetCollisionWorldDirection()

virtual const Vector* Murl::Graph::IBody::GetCollisionWorldDirection ( UInt32  collisionIndex) const
pure virtual

Get the normal vector of the collision.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
Returns
a constant pointer to the wold collision normal, or null if the index was out of range.

◆ GetCollisionDepth()

virtual Real Murl::Graph::IBody::GetCollisionDepth ( UInt32  collisionIndex) const
pure virtual

Get the depth of the collision along the collision's normal vector.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
Returns
The collision depth, or 0.0 if the index was out of range.

◆ GetCollisionBody()

virtual IBody* Murl::Graph::IBody::GetCollisionBody ( UInt32  collisionIndex,
UInt32  bodyIndex 
) const
pure virtual

Get a body involved in a specific collision.

Individual collisions always occur between only two bodies; if during a simulation step a body collides with more than one other body (or with the same body at more than one contact point), a number of individual pair-wise collisions are generated.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
bodyIndexThe index of the collision body, either 0 for this body or 1 for the other one.
Returns
a pointer to the involved body, or null if the index was out of range.

◆ GetCollisionGeometry()

virtual ICollider* Murl::Graph::IBody::GetCollisionGeometry ( UInt32  collisionIndex,
UInt32  bodyIndex 
) const
pure virtual

Get the actual collider of a body involved in a specific collision.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
bodyIndexThe index of the collision body, either 0 for this body or 1 for the other one.
Returns
a pointer to involved body's collider, or null if the index was out of range.

◆ GetCollisionSurfaceIndex()

virtual UInt32 Murl::Graph::IBody::GetCollisionSurfaceIndex ( UInt32  collisionIndex,
UInt32  bodyIndex 
) const
pure virtual

Get the surface index of a collision.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
bodyIndexThe index of the collision body for which to get the index, either 0 for this body or 1 for the other one.
Returns
The surface index.

◆ GetCollisionPartner()

virtual IBody* Murl::Graph::IBody::GetCollisionPartner ( UInt32  collisionIndex) const
pure virtual

DEPRECATED: Get the partner of a specific collision.

Use GetCollisionBody(collisionIndex, 1) instead.

Parameters
collisionIndexThe collision index, in the range from 0 to GetNumberOfCollisions().
Returns
a pointer to the collision's other involved body, or null if the index was out of range.

◆ ResolveCollisions()

virtual Vector Murl::Graph::IBody::ResolveCollisions ( const IBody partner,
Real  margin 
) const
pure virtual

Resolve all collisions, optionally with a given partner only.

This method tries to resolve all pending collisions of this body, optionally restricted to collisions with a given partner only. The result is a direction vector that represents the world space offset to be applied to the body so that it does not collide with any other objects anymore. If no collisions are pending, a zero direction vector is returned. Applying the resulting offset vector to a body's position should be done only on bodies for which the collision/force/torque effect is manually disabled, e.g. a player character that should be precisely controlled by explicitly setting its velocity instead of applying forces. Setting the "margin" parameter to a positive non-zero value pushes all collisions "inward" by that distance. This allows to also detect collisions that do not actually occur, but become relevant during collision resolution. Ideally, this value should be set to the maximum distance a body can be moved between subsequent ticks, but may be lower. However, any collision geometry used must be enlarged by that value to give the same result.

Parameters
partnerThe collision partner to query, or null if all partners should be queried.
marginThe collision margin.
Returns
The offset vector.

◆ GetBodyTransform() [1/2]

virtual const Matrix& Murl::Graph::IBody::GetBodyTransform ( ) const
pure virtual

Get a constant reference to the body's current world transform matrix.

Returns
The world transform.

◆ GetBodyTransform() [2/2]

virtual Matrix& Murl::Graph::IBody::GetBodyTransform ( )
pure virtual

Get a mutable reference to the body's current world transform matrix.

Returns
The world transform.

◆ GetNumberOfStages()

virtual UInt32 Murl::Graph::IBody::GetNumberOfStages ( ) const
pure virtual

Get the body's number of stages.

Returns
The number of stages.

◆ GetPhysicsBodyObject()

virtual Physics::IBody* Murl::Graph::IBody::GetPhysicsBodyObject ( UInt32  stage) const
pure virtual

Get the body's internal physics simulator object.

Parameters
stageThe stage to query.
Returns
The physics simulator object.

The documentation for this interface was generated from the following file:
  • murl_graph_i_body.h


Copyright © 2011-2024 Spraylight GmbH.