Drag[en]gine Game Engine
1.21
|
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... | |
deResource * | GetResource () const |
Attached resource. More... | |
const decVector & | GetPosition () 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 decQuaternion & | GetOrientation () 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 decVector & | GetScaling () const |
Scaling of the attached resource relative to the attachment point. More... | |
void | SetScaling (const decVector &scaling) |
Set scaling of the attached resource relative to the attachment point. More... | |
bool | GetNoScaling () const |
Ignore scaling. More... | |
void | SetNoScaling (bool noScaling) |
Set if scaling is ignored. More... | |
const decString & | GetTrackBone () 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... | |
sWeight * | GetWeights () 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... | |
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.
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. |
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.
EInvalidParam | resource is NULL. |
EInvalidParam | CanAttachResource() returns false for resource. |
deColliderAttachment::~deColliderAttachment | ( | ) |
Clean up the collider attachement object.
|
static |
Determine if a resource is valid for attaching.
Creating an attachment fails if CanAttachResource returns false.
|
inline |
Attach type.
|
inline |
Ignore scaling.
|
inline |
Orientation of the attached resource relative to the attachment point.
|
inline |
Position of the attached resource relative to the attachment point.
|
inline |
Attached resource.
|
inline |
Scaling of the attached resource relative to the attachment point.
|
inline |
Name of the bone to track in the target collider or null if not used.
|
inline |
Count of bone weights.
|
inline |
Pointer to array of bone weights.
void deColliderAttachment::SetAttachType | ( | eAttachType | attachType | ) |
Set attach type.
EInvalidParam | attachType does not match any of deColliderAttachment::eAttachType. |
void deColliderAttachment::SetNoScaling | ( | bool | noScaling | ) |
Set if scaling is ignored.
void deColliderAttachment::SetOrientation | ( | const decQuaternion & | orientation | ) |
Set orientation of the attached resource relative to the attachment point.
void deColliderAttachment::SetPosition | ( | const decVector & | position | ) |
Set position of the attached resource relative to the attachment point.
void deColliderAttachment::SetScaling | ( | const decVector & | scaling | ) |
Set scaling of the attached resource relative to the attachment point.
void deColliderAttachment::SetTrackBone | ( | const char * | bone | ) |
Set name of the bone to track in the target collider or an empty string if not used.
EInvalidParam | bone is NULL. |
void deColliderAttachment::SetWeightCount | ( | int | count | ) |
Set number of bone weights.
EInvalidParam | count is less than 0. |