This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_grabber [2022/02/05 19:03] – dragonlord | dragengine:modules:dragonscript:behavior_grabber [2025/03/13 17:13] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 22: | 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 63: | Line 89: | ||
====== 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 105: | 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:// |