This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_grabber [2022/02/05 18:36] – created dragonlord | dragengine:modules:dragonscript:behavior_grabber [2025/03/13 17:13] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 16: | Line 16: | ||
To detect grab spots a touch sensor is added with a default sphere shape. By default the touch sensor is disabled and has to be enabled if the game logic allows grabbing. The collision filter category is set to BaseGameApp.CollisionFilterBit.trigger and the collision filter mask is set to BaseGameApp.CollisionFilterBit.dynamic. | To detect grab spots a touch sensor is added with a default sphere shape. By default the touch sensor is disabled and has to be enabled if the game logic allows grabbing. The collision filter category is set to BaseGameApp.CollisionFilterBit.trigger and the collision filter mask is set to BaseGameApp.CollisionFilterBit.dynamic. | ||
- | |||
- | Element class properties have the prefix " | ||
- | |||
====== Instance Counts ====== | ====== Instance Counts ====== | ||
Line 25: | Line 22: | ||
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix | + | Element class properties have the prefix |
===== shape ===== | ===== shape ===== | ||
Shape of collider used to detect grab spots. | Shape of collider used to detect grab spots. | ||
- | * Full name: "grabber.shape" | + | * Full name: '' |
- | * Type: string (shape | + | * Type: string (shape |
* Default Value: empty string | * Default Value: empty string | ||
* Example (*.deeclass): | * Example (*.deeclass): | ||
- | ===== attach.position ===== | + | ===== position ===== |
Attach position relative to parent element or bone. | Attach position relative to parent element or bone. | ||
- | * Full name: "grabber.attach.position" | + | * Full name: '' |
- | * Type: 3-component vector | + | * Type: 3-component |
- | * Default Value: (0, 0, 0) | + | * Default Value: |
- | * Example (*.deeclass): | + | * Example (*.deeclass): |
- | ===== attach.rotation ===== | + | ===== rotation ===== |
Attach orientation in euler degrees relative to parent element or bone. | Attach orientation in euler degrees relative to parent element or bone. | ||
- | * Full name: "grabber.attach.rotation" | + | * Full name: '' |
- | * Type: 3-component vector | + | * Type: 3-component |
- | * Default Value: (0, 0, 0) | + | * Default Value: |
- | * Example (*.deeclass): | + | * Example (*.deeclass): |
- | ===== attach.bone ===== | + | ===== bone ===== |
Name of bone to attach to or empty string to attach to the parent element. | Name of bone to attach to or empty string to attach to the parent element. | ||
- | * Full name: "grabber.attach.bone" | + | * Full name: '' |
* Type: string | * Type: string | ||
* Default Value: empty string | * Default Value: empty string | ||
- | * Example (*.deeclass): | + | * Example (*.deeclass): |
+ | |||
+ | ====== Events ====== | ||
+ | |||
+ | ===== spotGrabbed ===== | ||
+ | |||
+ | Grabber grabbed grab spot. | ||
+ | |||
+ | ===== spotReleased ===== | ||
+ | |||
+ | Grabber released grab spot. | ||
+ | |||
+ | ===== touchGrabSpot ===== | ||
+ | |||
+ | Start touching grab spot. | ||
+ | |||
+ | ===== untouchGrabSpot ===== | ||
+ | |||
+ | Stop touching grab spot. | ||
+ | |||
+ | ===== canTouchGrabSpot ===== | ||
+ | |||
+ | Grab spot can be touched if all listeners return true. | ||
+ | |||
+ | ===== enabledChanged ===== | ||
+ | |||
+ | Grabber enabled changed. | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
Line 61: | Line 84: | ||
====== Optional Behaviors ====== | ====== Optional Behaviors ====== | ||
- | This behavior does not support optional behaviors. | + | * [[behavior_collider|ECBehaviorCollider]]: |
+ | * [[behavior_vrhand|ECBehaviorVRHand]]: | ||
====== Persistency ====== | ====== Persistency ====== | ||
- | Saves these parameters: | + | This behavior does support element class to be persistable (setPersistable). |
- | * Enabled | + | |
- | * [[behavior_grabspot|ECBehaviorGrabSpot]] | + | |
====== API Documentation ====== | ====== API Documentation ====== | ||
- | [[https:// | + | # |
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
====== Use Cases ====== | ====== Use Cases ====== | ||
Line 107: | Line 129: | ||
</ | </ | ||
- | The [[https:// | + | The # |
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | <!-- optional: use vr hand with id instead of empty string --> | ||
+ | <string name=' | ||
+ | |||
+ | <!-- optional: set collision filter. default value ' | ||
+ | | ||
+ | | ||
+ | | ||
+ | are a list of bits to set. --> | ||
+ | <string name=' | ||
+ | |||
+ | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
+ | <string name=' | ||
+ | </ | ||
+ | |||
+ | <!-- for adding multiple behaviors use unique identifiers --> | ||
+ | < | ||
+ | <string name=' | ||
+ | <string name=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
====== Live Examples ====== | ====== Live Examples ====== | ||
* [[https:// | * [[https:// |