This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_grabspot [2024/03/14 16:54] – dragonlord | dragengine:modules:dragonscript:behavior_grabspot [2025/03/13 17:13] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 21: | Line 21: | ||
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix | + | Element class properties have the prefix |
===== touchCollider.physicsType ===== | ===== touchCollider.physicsType ===== | ||
Physics type of touch collider used to detect touching grabbers. | Physics type of touch collider used to detect touching grabbers. | ||
- | * Full name: "grabSpot.touchCollider.physicsType" | + | * Full name: '' |
- | * Type: string of values "none", " | + | * Type: enumeration |
- | * Default Value: | + | * < |
+ | ^Value^Description^ | ||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | </ | ||
+ | * Default Value: | ||
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== touchCollider.localGravity ===== | ===== touchCollider.localGravity ===== | ||
Local gravity of touch collider if not affected by world gravity. | Local gravity of touch collider if not affected by world gravity. | ||
- | * Full name: "grabber.touchCollider.localGravity" | + | * Full name: '' |
* Type: 3-component vector | * Type: 3-component vector | ||
- | * Default Value: (0, 0, 0) | + | * Default Value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== touchCollider.weight ===== | ===== touchCollider.weight ===== | ||
Weight (mass) of touch collider if dynamic. | Weight (mass) of touch collider if dynamic. | ||
- | * Full name: "grabber.touchCollider.weight" | + | * Full name: '' |
* Type: float | * Type: float | ||
- | * Default Value: 1 | + | * Default Value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== touchCollider.enabled ===== | ===== touchCollider.enabled ===== | ||
Initial enabled state of touch collider. | Initial enabled state of touch collider. | ||
- | * Full name: "grabber.touchCollider.enabled" | + | * Full name: '' |
* Type: boolean | * Type: boolean | ||
- | * Default Value: true | + | * Default Value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== touchCollider.shape ===== | ===== touchCollider.shape ===== | ||
Shape of touch collider used to detect grabbers. | Shape of touch collider used to detect grabbers. | ||
- | * Full name: "grabSpot.touchCollider.shape" | + | * Full name: '' |
- | * Type: string (shape | + | * Type: string (shape |
* Default Value: empty string | * Default Value: empty string | ||
* Example (*.deeclass): | * Example (*.deeclass): | ||
Line 60: | Line 66: | ||
===== touchCollider.rig ===== | ===== touchCollider.rig ===== | ||
Rig resource to use for touch collider. | Rig resource to use for touch collider. | ||
- | * Full name: "grabSpot.touchCollider.rig" | + | * Full name: '' |
- | * Type: string | + | * Type: string |
+ | * File Pattern: '' | ||
* Default Value: empty path | * Default Value: empty path | ||
* Example (*.deeclass): | * Example (*.deeclass): | ||
- | ===== attach.position ===== | + | ===== position ===== |
Touch collider attach position relative to parent element or bone. | Touch collider attach position relative to parent element or bone. | ||
- | * Full name: "grabSpot.attach.position" | + | * Full name: '' |
* Type: 3-component vector | * Type: 3-component vector | ||
- | * Default Value: (0, 0, 0) | + | * Default Value: |
- | * Example (*.deeclass): | + | * Example (*.deeclass): |
- | ===== attach.rotation ===== | + | ===== rotation ===== |
Touch collider attach orientation in euler degrees relative to parent element or bone. | Touch collider attach orientation in euler degrees relative to parent element or bone. | ||
- | * Full name: "grabSpot.attach.rotation" | + | * Full name: '' |
* Type: 3-component vector | * Type: 3-component vector | ||
- | * Default Value: (0, 0, 0) | + | * Default Value: |
- | * Example (*.deeclass): | + | * Example (*.deeclass): |
- | ===== attach.bone ===== | + | ===== bone ===== |
Name of bone to attach touch collider to or empty string to attach to the parent element. | Name of bone to attach touch collider to or empty string to attach to the parent element. | ||
- | * Full name: "grabSpot.attach.bone" | + | * Full name: '' |
* Type: string | * Type: string | ||
* Default Value: empty string | * Default Value: empty string | ||
- | * Example (*.deeclass): | + | * Example (*.deeclass): |
+ | |||
+ | ====== Events ====== | ||
+ | |||
+ | ===== spotGrabbed ===== | ||
+ | |||
+ | Grabber has grabbed spot. | ||
+ | |||
+ | ===== spotReleased ===== | ||
+ | |||
+ | Grabber has release spot. | ||
+ | |||
+ | ===== enabledChanged ===== | ||
+ | |||
+ | Grab spot enabled changed. | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
- | This behavior does not required other behaviors to be present. | + | |
+ | This behavior does not required other behaviors to be present. | ||
====== Optional Behaviors ====== | ====== Optional Behaviors ====== | ||
Line 95: | Line 117: | ||
====== Persistency ====== | ====== Persistency ====== | ||
- | Saves these parameters: | + | This behavior does support element class to be persistable (setPersistable). |
- | + | ||
- | * Enabled | + | |
- | * [[behavior_grabber|ECBehaviorGrabber]] | + | |
====== API Documentation ====== | ====== API Documentation ====== | ||
# | # | ||
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
====== Use Cases ====== | ====== Use Cases ====== | ||
+ | |||
* Allow player to grab objects in VR with his hands. | * Allow player to grab objects in VR with his hands. | ||
* Add different grab spots on an object in VR to alter the interactions the player can do. | * Add different grab spots on an object in VR to alter the interactions the player can do. | ||
Line 127: | Line 147: | ||
end | end | ||
end | end | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | < | ||
+ | <!-- 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 --> | ||
+ | < | ||
+ | </ | ||
</ | </ | ||