Table of Contents

, ,

Start Page » DEMoCap: Drag[en]gine Motion Capture » XML Element Classes » ECBGrabAttach

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.

Instance Counts

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

Element class properties have the prefix grabAttach. or grabAttach({id}). if id is not empty.

bone

Bone to attach actor hand to or empty string to attach to object.

immobile

Object can not be moved. Useful to prevent object to be accidentially moved until the user explicitely enables it.

ikLockRotation

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.

align

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.

position

Position relative to the grab spot.

rotation

Rotation in degrees relative to the grab spot.

Events

This behavior has no events.

Conversation Commands

This behavior adds no conversation commands.

Conversation Conditions

This behavior adds no conversation conditions.

Behavior Tree Actions

This behavior adds no behavior tree actions.

Behavior Tree Conditions

This behavior adds no behavior tree conditions.

Required Behaviors

Optional Behaviors

API Documentation

Since DEMoCap Version 1.3

Use Cases

Element Class Example

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

Behavior Factory

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>

Live Examples