Drag[en]gine Game Engine  1.0
deColliderAttachment Class Reference

Attach resources to a collider. More...

#include <deColliderAttachment.h>

Classes

struct  sWeight
 Weighted bone used for eatBone. More...
 

Public Types

enum  eAttachType {
  eatStatic, eatRig, eatBone, eatWeight,
  eatRelativeMovement
}
 Attachment types. More...
 

Public Member Functions

Constructors and Destructors
 deColliderAttachment (deResource *resource)
 Create a new attachement. More...
 
 ~deColliderAttachment ()
 Clean up the collider attachement object. More...
 

Management

eAttachType GetAttachType () const
 Attach type. More...
 
void SetAttachType (eAttachType attachType)
 Set attach type. More...
 
deResourceGetResource () const
 Attached resource. More...
 
const decVectorGetPosition () const
 Position of the attached resource relative to the attachment point. More...
 
void SetPosition (const decVector &position)
 Set position of the attached resource relative to the attachment point. More...
 
const decQuaternionGetOrientation () const
 Orientation of the attached resource relative to the attachment point. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation of the attached resource relative to the attachment point. More...
 
const decStringGetTrackBone () const
 Name of the bone to track in the target collider or null if not used. More...
 
void SetTrackBone (const char *bone)
 Set name of the bone to track in the target collider or an empty string if not used. More...
 
int GetWeightCount () const
 Count of bone weights. More...
 
sWeightGetWeights () const
 Pointer to array of bone weights. More...
 
void SetWeightCount (int count)
 Set number of bone weights. More...
 
static bool CanAttachResource (const deResource &resource)
 Determine if a resource is valid for attaching. More...
 

Detailed Description

Attach resources to a collider.

Stores information about a resource attached to a a collider. The following resource types can be attached:

All other resource types will generate an exception if attempted to be attached. Resources can be attached using different modes. Not all of them are supported for all resource types. See deColliderAttachment::aAttachType for details.

In the case of attached collider resource of type component or rig a source bone can be specified. If such a bone is defined it is used to attach the collider instead of the collider origin itself. For all other resource types this is not used.

Author
Pl├╝ss Roland
Version
1.0
Date
2015

Member Enumeration Documentation

◆ eAttachType

Attachment types.

Enumerator
eatStatic 

Attach to collider origin.

Supported for all resources on all collider types.

eatRig 

Attach to a rig.

Supported on colliders of type component or rig if a rig is set. Supported only for resources of type collider of type component or rig. All other resources are treated like deColliderAttachment::eatStatic. For the supported resource the state of each target bone is copied to the attached bone with the same name. Not matched bones do not get their state changed.

eatBone 

Attach to a bone.

Supported on colliders of type component or rig if a rig is set. Supported on all resource types. The resource is attached to the bone coordinate frame.

eatWeight 

Attach to multiple bones.

Supported on colliders of type component or rig if a rig is set. Supported on all resource types. The resource is attached to the coordinate frame calculate by weighting the coordinate frames of multiple bones. With one bone this behaves the same as deColliderAttachment::eatBone. With no bone this behaves the same as deColliderAttachment::eatStatic.

eatRelativeMovement 

Attach with relative movement like riding a platform.

Supported for all resources on all collider types. The position of the attached resource is kept relative to the target collider. Movement of the resource relative to the collider is carried over allowing to use this attachment mode to simulate objects riding on other objects where physics is not a suitable option. This is the typical choice for simulating actors riding on platforms.

Constructor & Destructor Documentation

◆ deColliderAttachment()

deColliderAttachment::deColliderAttachment ( deResource resource)

Create a new attachement.

The new attachment holds a reference to the resource. The attachment mode is set to deColliderAttachment::eatStatic.

Exceptions
EInvalidParamresource is NULL.
EInvalidParamCanAttachResource() returns false for resource.

Referenced by deColliderAttachment::sWeight::sWeight().

◆ ~deColliderAttachment()

deColliderAttachment::~deColliderAttachment ( )

Clean up the collider attachement object.

Referenced by deColliderAttachment::sWeight::sWeight().

Member Function Documentation

◆ CanAttachResource()

static bool deColliderAttachment::CanAttachResource ( const deResource resource)
static

Determine if a resource is valid for attaching.

Creating an attachment fails if CanAttachResource returns false.

Referenced by GetWeights().

◆ GetAttachType()

eAttachType deColliderAttachment::GetAttachType ( ) const
inline

Attach type.

References SetAttachType().

◆ GetOrientation()

const decQuaternion& deColliderAttachment::GetOrientation ( ) const
inline

Orientation of the attached resource relative to the attachment point.

References SetOrientation().

◆ GetPosition()

const decVector& deColliderAttachment::GetPosition ( ) const
inline

Position of the attached resource relative to the attachment point.

References SetPosition().

◆ GetResource()

deResource* deColliderAttachment::GetResource ( ) const
inline

Attached resource.

◆ GetTrackBone()

const decString& deColliderAttachment::GetTrackBone ( ) const
inline

Name of the bone to track in the target collider or null if not used.

References deColliderAttachment::sWeight::bone, and SetTrackBone().

◆ GetWeightCount()

int deColliderAttachment::GetWeightCount ( ) const
inline

Count of bone weights.

◆ GetWeights()

sWeight* deColliderAttachment::GetWeights ( ) const
inline

Pointer to array of bone weights.

References CanAttachResource(), and SetWeightCount().

◆ SetAttachType()

void deColliderAttachment::SetAttachType ( eAttachType  attachType)

Set attach type.

Exceptions
EInvalidParamattachType does not match any of deColliderAttachment::eAttachType.

Referenced by GetAttachType().

◆ SetOrientation()

void deColliderAttachment::SetOrientation ( const decQuaternion orientation)

Set orientation of the attached resource relative to the attachment point.

Referenced by GetOrientation().

◆ SetPosition()

void deColliderAttachment::SetPosition ( const decVector position)

Set position of the attached resource relative to the attachment point.

Referenced by GetPosition().

◆ SetTrackBone()

void deColliderAttachment::SetTrackBone ( const char *  bone)

Set name of the bone to track in the target collider or an empty string if not used.

Exceptions
EInvalidParambone is NULL.

Referenced by GetTrackBone().

◆ SetWeightCount()

void deColliderAttachment::SetWeightCount ( int  count)

Set number of bone weights.

Exceptions
EInvalidParamcount is less than 0.

Referenced by GetWeights().


The documentation for this class was generated from the following file: