{{tag>motioncapture democap behavior}}
[[:start|Start Page]] >> [[main|DEMoCap: Drag[en]gine Motion Capture]] >> [[democap:elementclasses|XML Element Classes]] >> ** 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 [[dragengine:modules:dragonscript:behavior_collider|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) false
===== 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) false
===== 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) true
===== useLocalGravity =====
Use local gravity defined by ''gravity'' instea of world gravity.
* Full name: ''colliderPhysics.useLocalGravity''
* Type: boolean
* Default Value: ''false''
* Example (*.deeclass) false
===== 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)
===== 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) 1
===== canGrabActor =====
Actor can grab physics bones of object.
* Full name: ''colliderPhysics.canGrabActor''
* Type: boolean
* Default Value: ''true''
* Example (*.deeclass) true
====== 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 ======
* [[dragengine:modules:dragonscript:behavior_collider|ECBehaviorCollider]]
* [[behavior_ecbbehaviorguipanels|ECBBehaviorGuiPanels]]
* [[behavior_ecbcapturedanimations|ECBCapturedAnimations]]
====== 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):
second
false
====== Live Examples ======