Start Page » DEMoCap: Drag[en]gine Motion Capture » XML Element Classes » ECBGrabAttach
Behavior adding support to attach object to actor while being grabbed. This behavior can be used on the element to grab or on an attached element to grab the parent.
To grab the element itself ECBehaviorAttachable has to be present.
To grab the parent the parent object ID has to be set (stub.setAttachTo()) together with an optional bone. While entering the game world element is attached to the parent using relative attachment.
This behavior can be used only once on an element.
This element behavior can be present multiple times in a BehaviorElement. In this case use a unique identifier to distinguish the individual behavior instances.
Element class properties have the prefix grabAttach.
or grabAttach({id}).
if id is not empty.
Bone to attach actor hand to or empty string to attach to object.
grabAttach.bone
or grabAttach({id}).bone
<string name='grabAttach.bone'>bone</string>
Object can not be moved. Useful to prevent object to be accidentially moved until the user explicitely enables it.
grabAttach.immobile
or grabAttach({id}).immobile
false
<boolean name='grabAttach.immobile'>false</boolean>
Upon grabbing the bone or object the actor hand IK target is rotation locked. This has the effect of enforcing the actor hand to keep the same rotation relative to the bone or object compared to the time he grabbed the object.
grabAttach.ikLockRotation
or grabAttach({id}).ikLockRotation
false
<boolean name='grabAttach.ikLockRotation'>false</boolean>
Upon grabbing the bone or object the actor hand IK target is aligned with the attach position and orientation. This has the effect of enforcing the actor hand to snap to a specific position and rotation relative to the bone or object. Typical used for handles where the hand is required to be in the exact right position for the animation to not look wrong.
grabAttach.align
or grabAttach({id}).align
true
<boolean name='grabAttach.align'>true</boolean>
Position relative to the grab spot.
grabAttach.position
or grabAttach({id}).position
(0, 0, 0)
<vector name='grabAttach.position' x='0' y='0' z='0.2'/>
Rotation in degrees relative to the grab spot.
grabAttach.rotation
or grabAttach({id}).rotation
(0, 0, 0)
<vector name='grabAttach.rotation' x='0' y='90' z='0'/>
This behavior has no events.
This behavior adds no conversation commands.
This behavior adds no conversation conditions.
This behavior adds no behavior tree actions.
This behavior adds no behavior tree conditions.
Since DEMoCap Version 1.3
class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorCollider collider public var ECBehaviorGrabSpot grabSpot public var ECBehaviorAttachable attachable public var ECBBehaviorGuiPanels guiPanels public var ECBSelectable selectable public var ECBShowInteractHandles showInteractHandles public var ECBGrabAttach grabAttach func new() component = ECBehaviorComponent.new(this) collider = ECBehaviorCollider.new(this, component) grabSpot = ECBehaviorGrabSpot.new(this, collider) grabSpot.getAttachTouchCollider().getPosition().setVector(Vector.new(0, 0, 0.1)) attachable = ECBehaviorAttachable.new(this, collider) guiPanels = ECBBehaviorGuiPanels.new(this) selectable = ECBSelectable.new(this) showInteractHandles = ECBShowInteractHandles.new(this, guiPanels, selectable) grabAttach = ECBGrabAttach.new(this, guiPanels, grabSpot, collider, attachable, showInteractHandles) end end
Using element class supporting adding behaviors the behavior can be added like this (again create an example which creates a valid element class):
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorComponent'/> <behavior type='ECBehaviorCollider'/> <behavior type='ECBehaviorGrabSpot'/> <behavior type='ECBehaviorAttachable'/> <behavior type='ECBBehaviorGuiPanels'/> <behavior type='ECBSelectable'/> <behavior type='ECBShowInteractHandles'> <list name='handleSets'> <string>move</string> <string>rotate</string> </list> <float name='.handleSize'>0.2</float> </behavior> <behavior type='ECBGrabAttach'> <!-- optional: use grab spot with id instead of empty string --> <string name='grabSpot'>second</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <boolean name='.align'>false</boolean> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBGrabAttach' id='second'/> </elementClass>