This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_controldesktop [2024/03/14 16:50] – dragonlord | dragengine:modules:dragonscript:behavior_controldesktop [2025/03/13 17:13] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 27: | Line 27: | ||
====== Element Class Properties ====== | ====== Element Class Properties ====== | ||
- | Element class properties have the prefix | + | Element class properties have the prefix |
===== lowerLeft ===== | ===== lowerLeft ===== | ||
Virtual plane lower left position in component space. | Virtual plane lower left position in component space. | ||
- | * Full name: "controlDesktop.lowerLeft" | + | * Full name: '' |
- | * Type: vector | + | * Type: 3-point float vector |
- | * Default value: | + | * Default value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== lowerRight ===== | ===== lowerRight ===== | ||
Virtual plane lower right position. | Virtual plane lower right position. | ||
- | * Full name: "controlDesktop.lowerRight" | + | * Full name: '' |
- | * Type: vector | + | * Type: 3-point float vector |
- | * Default value: | + | * Default value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== upperLeft ===== | ===== upperLeft ===== | ||
Virtual plane upper left position. | Virtual plane upper left position. | ||
- | * Full name: "controlDesktop.upperLeft" | + | * Full name: '' |
- | * Type: vector | + | * Type: 3-point float vector |
- | * Default value: | + | * Default value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
===== bone ===== | ===== bone ===== | ||
Name of bone to use as coordinate system for the virtual plane or empty string to use the component coordinate system. | Name of bone to use as coordinate system for the virtual plane or empty string to use the component coordinate system. | ||
- | * Full name: "controlDesktop.bone" | + | * Full name: '' |
* Type: string | * Type: string | ||
- | * Default Value: | + | * Default Value: |
* Example (*.deeclass): | * Example (*.deeclass): | ||
Line 67: | Line 67: | ||
====== Persistency ====== | ====== Persistency ====== | ||
- | This behavior does not use persistency. | + | This behavior does not required element class to be persistable (setPersistable). |
====== API Documentation ====== | ====== API Documentation ====== | ||
Line 73: | Line 73: | ||
# | # | ||
- | Since DragonScript Module Version | + | Since DragonScript Module Version |
====== Use Cases ====== | ====== Use Cases ====== | ||
Line 92: | Line 92: | ||
| | ||
- | | + | |
component = ECBehaviorComponent.new(this, | component = ECBehaviorComponent.new(this, | ||
| | ||
- | | + | |
- | | + | |
dynamicSkin = ECBehaviorDynamicSkin.new(this, | dynamicSkin = ECBehaviorDynamicSkin.new(this, | ||
| | ||
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
renderableDesktop = ECBehaviorRenderableDesktop.new(this, | renderableDesktop = ECBehaviorRenderableDesktop.new(this, | ||
renderableDesktop.getRenderable().setValue(" | renderableDesktop.getRenderable().setValue(" | ||
renderableDesktop.getSize().setPoint(Point.new(1024, | renderableDesktop.getSize().setPoint(Point.new(1024, | ||
| | ||
- | | + | |
- | | + | |
- | | + | |
controlDesktop = ECBehaviorControlDesktop.new(this, | controlDesktop = ECBehaviorControlDesktop.new(this, | ||
end | end | ||
Line 129: | Line 129: | ||
super.think(elapsed) | super.think(elapsed) | ||
| | ||
- | | + | |
if vrRightHandPointAt.hasVRHandPointAtElement() | if vrRightHandPointAt.hasVRHandPointAtElement() | ||
- | // Store the hit element and hit point in world space. Typically you want | + | '' |
- | // to test them against mulitple supported interactions. | + | '' |
var BehaviorElement element = vrRightHandPointAt.getPointAtBehaviorElement() | var BehaviorElement element = vrRightHandPointAt.getPointAtBehaviorElement() | ||
var DVector hitPoint = vrRightHandPointAt.getPointAtHitPoint() | var DVector hitPoint = vrRightHandPointAt.getPointAtHitPoint() | ||
- | // Move mouse on the desktop controller if present in the pointed at element | + | '' |
var ECBehaviorControlDesktop.Instance controlDesktop = ECBehaviorControlDesktop.getInstanceIn(element) | var ECBehaviorControlDesktop.Instance controlDesktop = ECBehaviorControlDesktop.getInstanceIn(element) | ||
if controlDesktop != null | if controlDesktop != null | ||
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
if controlDesktop.moveMouse(hitPoint) | if controlDesktop.moveMouse(hitPoint) | ||
| | ||
Line 150: | Line 150: | ||
end | end | ||
- | // Here you could check for other supported interactions | + | '' |
end | end | ||
| | ||
- | | + | |
end | end | ||
end | end | ||
Line 160: | Line 160: | ||
The same example can be done using [[behavior_lookat|ECBehaviorLookAt]] instead of [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]]. | The same example can be done using [[behavior_lookat|ECBehaviorLookAt]] instead of [[behavior_vrhandpointat|ECBehaviorVRHandPointAt]]. | ||
+ | |||
+ | ====== Behavior Factory ====== | ||
+ | |||
+ | Using element class supporting adding behaviors the behavior can be added like this: | ||
+ | <code xml> | ||
+ | <?xml version=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | < | ||
+ | <!-- set element properties. omit property prefix if used inside behavior tag --> | ||
+ | <string name=' | ||
+ | </ | ||
+ | | ||
+ | <!-- for adding multiple behaviors use unique identifiers --> | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
====== Live Examples ====== | ====== Live Examples ====== | ||
* [[https:// | * [[https:// | ||
+ |