LuaDocs/Attachable
From Data Realms Wiki
Contents |
Parent: MOSRotating
Concrete Class. An articulated, detachable part of an Actor's body.
Properties
ClassName
The class name of this Entity.A string with the friendly-formatted type name of this object.
ParentOffset
The stored offset between this Attachable's parent's Pos and the joint position. This should be maintained by the parent.A const reference Vector describing the offset from the parent's pos to the joint point.
JointOffset
Read-only property. The offset to the joint (the point around which this Attachable and its parent hinge) from this Attachable's center of mass/origin.A const reference Vector describing the offset of the joint relative to the this Attachable's origin/center of mass position.
JointStiffness
Sets the normalized stiffness scalar of the join of this Attachable.A float between 0 and 1.0. 1.0 means 100% of all forces imposed on this attachable will be transferred through the joint to the parent. 0.5 means 50%, and so on.
RotTarget
The target rotation that this Attachable should be striving to match its real rotation with, if it is attached. The joint stiffness will determine how strong the scalar spring is between the current rotation and the target set here.A float for the current target angle in radians.
AtomSubgroupID
The subgroup ID of this' Atoms.The the subgroup ID of this' Atoms.
OnlyLinearForces
Indicates whether this AEmitter only cares about linear forces that it creates through emissions, ie no torquing due to the parent offset.Whether only using linear forces or not.
Functions
IsAttached
Indicates whether this Attachable is attached to an MOSprite or not.
Arguments:
- None.
Return value:
Whether it's attached or not.
IsAttachedTo
Indicates whether this Attachable is attached to a specific actor or not.
Arguments:
- A pointer to which MOSprite you want to check if this is attached to.
Return value:
Whether it's attached or not.
IsDrawnAfterParent
Indicates whether this Attachable is to be drawn after (in front of) or before (behind) the parent.
Arguments:
- None.
Return value:
Whether it's to be drawn after parent or not.
Detach
Detaches this Attachable from its host MOSprite
Arguments:
- None.
Return value:
None.
TransferJointForces
Bundles up all the accumulated forces of this Attachable and calcs how they transfer to the joint, and therefore to the parent.
Arguments:
- A vector that will have with the forces affecting the joint ADDED to it.
Return value:
If the accumulated forces exceed the strength of the joint, the attachable will only fill out the forces up to the strength threshold and then detach itself and return false, and the parent should react accordingly in that case (null out pointers to the Attachable).
TransferJointImpulses
Bundles up all the accumulated impulses of this Attachable and calcs how they transfer to the joint, and therefore to the parent.
Arguments:
- A vector that will have with the imps affecting the joint ADDED to it.
Return value:
If the accumulated impulses exceed the strength of the joint, the attachable will only fill out the impulses up to the strength threshold and then detach itself and return false, and the parent should react accordingly in that case (null out pointers to the Attachable).
CollectDamage
Gets the amount of damage points this Attachable has sustained and should cause its parent. Calling this will reset the damage count. This should normally be called AFTER Update() to get the correct damage for a given frame.
Arguments:
- None.
Return value:
A float with the damage points accumulated since the last time this method was called.