User Tools

Site Tools


democap:behavior_ecbcolliderphysics

ECBColliderPhysics

Behavior controlling physics parameter of controllers. Element class sets if colliders should be set to dynamic physics response or kinematic physics response. User can change this behavior for example when constructing own objects.

This behavior takes care of enabling/disabling the physics behavior on an array of ECBehaviorCollider depending on the current playback/recording state. During recording physics behavior is enabled. Otherwise physics is disabled. If the user enabled live physics then physics will be also enabled outside recording unless playing back.

Furthermore this behavior copies component bones to physics bones upon switching states to ensure the result is correct.

The weight of the entire element can be set. This is used as the total mass of all colliders. The mass of each collider is scaled uniformly to match the desired value.

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix colliderPhysics..

usePhysics

Enable physics while recording.

  • Full name: colliderPhysics.usePhysics
  • Type: boolean
  • Default Value: false
  • Example (*.deeclass)
    <boolean name='colliderPhysics.usePhysics'>false</boolean>

livePhysics

Enable physics while not recording, playing back nor preparing to capture. Basically this means while setting up scenes and object properties.

  • Full name: colliderPhysics.livePhysics
  • Type: boolean
  • Default Value: false
  • Example (*.deeclass)
    <boolean name='colliderPhysics.livePhysics'>false</boolean>

touchActor

Physically reacts to actor touching object with any part of his body. Disable to unintentionally move or tip over objects the actor just has to grab to interact with.

  • Full name: colliderPhysics.touchActor
  • Type: boolean
  • Default Value: true
  • Example (*.deeclass)
    <boolean name='colliderPhysics.touchActor'>true</boolean>

useLocalGravity

Use local gravity defined by gravity instea of world gravity.

  • Full name: colliderPhysics.useLocalGravity
  • Type: boolean
  • Default Value: false
  • Example (*.deeclass)
    <boolean name='colliderPhysics.useLocalGravity'>false</boolean>

gravity

Gravity to use instead of world gravity if useLocalGravity is enabled.

  • Full name: colliderPhysics.gravity
  • Type: 3-component float vector
  • Default Value: (0, 0, 0)
  • Example (*.deeclass)
    <vector name='colliderPhysics.gravity' x='0' y='0' z='0'/>

weight

Mass in kg of object. Mass is split across all dynamic object bones relative to their mass distribution set in the rig resource.

  • Full name: colliderPhysics.weight
  • Type: float
  • Default Value: 1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='colliderPhysics.weight'>1</float>

canGrabActor

Actor can grab physics bones of object.

  • Full name: colliderPhysics.canGrabActor
  • Type: boolean
  • Default Value: true
  • Example (*.deeclass)
    <boolean name='colliderPhysics.canGrabActor'>true</boolean>

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

This behavior requires no other behaviors.

Optional Behaviors

API Documentation

Since DEMoCap Version 1.3

Use Cases

  • Allow actor to physically push or grab dynamic object bones.

Element Class Example

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorCollider collider
  public var ECBBehaviorGuiPanels guiPanels
  public var ECBCapturedAnimations capturedAnimations
  public var ECBColliderPhysics colliderPhysics
  func new()
    component = ECBehaviorComponent.new(this, null)
    collider = ECBehaviorCollider.new(this, component)
    guiPanels = ECBBehaviorGuiPanels.new(this)
    capturedAnimations = ECBCapturedAnimations.new(this, guiPanels, component, collider)
    colliderPhysics = ECBColliderPhysics.new(this, guiPanels, collider)
    colliderPhysics.capturedAnimations = capturedAnimations
  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='ECBBehaviorGuiPanels'/>
  <behavior type='ECBCapturedAnimations'/>
 
  <behavior type='ECBColliderPhysics'>
    <!-- optional: use component with id instead of empty string -->
    <string name='component'>second</string>
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <boolean name='.touchActor'>false</boolean>
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
democap/behavior_ecbcolliderphysics.txt · Last modified: 2025/03/22 17:26 by dragonlord