User Tools

Site Tools


dragengine:modules:dragonscript:behavior_forcefield

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behavior_forcefield [2025/04/30 19:59] – [Behavior Tree Conditions] dragonlorddragengine:modules:dragonscript:behavior_forcefield [2026/10/09 17:05] (current) – dragonlord
Line 20: Line 20:
 ====== Element Class Properties ====== ====== Element Class Properties ======
 Element class properties have the prefix ''forceField.'' or ''forceField({id}).'' if id is not empty. Element class properties have the prefix ''forceField.'' or ''forceField({id}).'' if id is not empty.
- 
-===== influenceArea ===== 
-Set influence area. Geometry touching this shape is affected by this force field. 
-  * Full name: ''forceField.influenceArea'' or ''forceField({id}).influenceArea'' 
-  * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString. 
-  * Default Value: empty string 
-  * Example (*.deeclass) <code xml><string name='forceField.influenceArea'>box:position,0,0.5,0:extends,2,1,0.5</string></code> 
- 
-===== radius ===== 
-Set falloff radius. Geometry inside this distance from the border is faded out gradually. 
-  * Full name: ''forceField.radius'' or ''forceField({id}).radius'' 
-  * Type: float 
-  * Default Value: ''1'' 
-  * Restriction: At least ''0'' 
-  * Example (*.deeclass) <code xml><float name='forceField.radius'>2</float></code> 
- 
-===== exponent ===== 
-Set falloff exponent. Shape of the fading out applied due to radius. Value of ''1'' represents linear fading. Values less than 1 fade of stronger near the border. Values greater than 1 fade of stronger near the inner border. 
-  * Full name: ''forceField.exponent'' or ''forceField({id}).exponent'' 
-  * Type: float 
-  * Default Value: 1 
-  * Restriction: At least 0 
-  * Example (*.deeclass) <code xml><float name='forceField.exponent'>0.5</float></code> 
- 
-===== fieldType ===== 
-Set field type. 
-  * Full name: ''forceField.fieldType'' or ''forceField({id}).fieldType'' 
-  * Type: enumeration 
-  * <WRAP>Allowed Values: 
-^Value^Description^ 
-|''radial''|Force is applied radial from the center.| 
-|''linear''|Force is applied along the force direction.| 
-|''vortex''|Force is applied vortex like swirling around.| 
-</WRAP> 
-  * Default Value: ''radial'' 
-  * Example (*.deeclass) <code xml><string name='forceField.fieldType'>linear</string></code> 
  
 ===== applicationType ===== ===== applicationType =====
Line 70: Line 34:
   * Default Value: ''direct''   * Default Value: ''direct''
   * Example (*.deeclass) <code xml><string name='forceField.applicationType'>mass</string></code>   * Example (*.deeclass) <code xml><string name='forceField.applicationType'>mass</string></code>
 +
 +===== bone =====
 +Set bone to attach resource to. If empty string attach to collider.
 +  * Full name: ''forceField.bone'' or ''forceField({id}).bone''
 +  * Type: string
 +  * Default Value: empty string
 +  * Example (*.deeclass) <code xml><string name='forceField.bone'>attach</string></code>
  
 ===== direction ===== ===== direction =====
Line 78: Line 49:
   * Example (*.deeclass) <code xml><vector name='forceField.direction' x='0' y='1' z='0'/></code>   * Example (*.deeclass) <code xml><vector name='forceField.direction' x='0' y='1' z='0'/></code>
  
-===== force ===== +===== collisionFilter ===== 
-Set force in newton. Negative force reverse direction. + 
-  * Full name: ''forceField.force'' or ''forceField({id}).force''+Set [[gamedev:collisionfiltering|collision filter]]. Filter bits are defined using a list of names mapped to collision filter bit indices using BaseGameApp.getCollisionFilterMap().  
 +  * Full name: ''collider.collisionFilter'' 
 +  * Type: string. Format can be ''category:filter'' or ''category'' where category and filter can be ''bit1 bit2 ... bitN'' with bit names looked up using the collision filter map. If only category is used filter is the same. 
 +  * Default Value: ''forceField:geometry dynamic actor actorAI particle'' 
 +  * Example (*.deeclass) <code xml><string name='collider.collisionFilter'>forceField:geometry dynamic actor actorAI particle trigger</string></code> 
 + 
 +===== enabled ===== 
 +Set force field enabled. 
 +  * Full name: ''forceField.enabled'' or ''forceField({id}).enabled'' 
 +  * Type: boolean 
 +  * Default Value: true 
 +  * Example (*.deeclass) <code xml><boolean name='forceField.enabled'>false</boolean></code> 
 + 
 +===== exponent ===== 
 +Set falloff exponent. Shape of the fading out applied due to radius. Value of ''1'' represents linear fading. Values less than 1 fade of stronger near the border. Values greater than 1 fade of stronger near the inner border. 
 +  * Full name: ''forceField.exponent'' or ''forceField({id}).exponent''
   * Type: float   * Type: float
   * Default Value: 1   * Default Value: 1
-  * Example (*.deeclass) <code xml><float name='forceField.force'>50</float></code>+  * Restriction: At least 0 
 +  * Example (*.deeclass) <code xml><float name='forceField.exponent'>0.5</float></code> 
 + 
 +===== fieldType ===== 
 +Set field type. 
 +  * Full name: ''forceField.fieldType'' or ''forceField({id}).fieldType'' 
 +  * Type: enumeration 
 +  * <WRAP>Allowed Values: 
 +^Value^Description^ 
 +|''radial''|Force is applied radial from the center.| 
 +|''linear''|Force is applied along the force direction.| 
 +|''vortex''|Force is applied vortex like swirling around.| 
 +</WRAP> 
 +  * Default Value: ''radial'' 
 +  * Example (*.deeclass) <code xml><string name='forceField.fieldType'>linear</string></code>
  
 ===== fluctuationDirection ===== ===== fluctuationDirection =====
Line 99: Line 99:
   * Example (*.deeclass) <code xml><float name='forceField.fluctuationForce'>20</float></code>   * Example (*.deeclass) <code xml><float name='forceField.fluctuationForce'>20</float></code>
  
-===== enabled ===== +===== force ===== 
-Set force field enabled. +Set force in newton. Negative force reverse direction. 
-  * Full name: ''forceField.enabled'' or ''forceField({id}).enabled'' +  * Full name: ''forceField.force'' or ''forceField({id}).force'' 
-  * Type: boolean +  * Type: float 
-  * Default Value: true +  * Default Value: 1 
-  * Example (*.deeclass) <code xml><boolean name='forceField.enabled'>false</boolean></code>+  * Example (*.deeclass) <code xml><float name='forceField.force'>50</float></code>
  
-===== shape ===== +===== influenceArea ===== 
-Set shape from which the force originates. If not set force originates from origin position. +Set influence area. Geometry touching this shape is affected by this force field. 
-  * Full name: ''forceField.shape'' or ''forceField({id}).shape''+  * Full name: ''forceField.influenceArea'' or ''forceField({id}).influenceArea''
   * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString.   * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString.
   * Default Value: empty string   * Default Value: empty string
-  * Example (*.deeclass) <code xml><string name='forceField.shape'>box:position,0,0.5,0:extends,2,1,0.5</string></code>+  * Example (*.deeclass) <code xml><string name='forceField.influenceArea'>box:position,0,0.5,0:extends,2,1,0.5</string></code> 
 + 
 +===== orientation ===== 
 +Set orientation to attach resource to collider in degrees. 
 +  * Full name: ''forceField.orientation'' or ''forceField({id}).orientation'' 
 +  * Type: 3-component float vector 
 +  * Default Value: (0,0,0) 
 +  * Example (*.deeclass) <code xml><vector name='forceField.orientation' x='30' y='0' z='0'/></code>
  
 ===== position ===== ===== position =====
Line 120: Line 127:
   * Example (*.deeclass) <code xml><vector name='forceField.position' x='0' y='0' z='0.1'/></code>   * Example (*.deeclass) <code xml><vector name='forceField.position' x='0' y='0' z='0.1'/></code>
  
-===== orientation ===== +===== radius ===== 
-Set orientation to attach resource to collider in degrees. +Set falloff radius. Geometry inside this distance from the border is faded out gradually. 
-  * Full name: ''forceField.orientation'' or ''forceField({id}).orientation'' +  * Full name: ''forceField.radius'' or ''forceField({id}).radius'' 
-  * Type: 3-component float vector +  * Type: float 
-  * Default Value: (0,0,0) +  * Default Value: ''1'' 
-  * Example (*.deeclass) <code xml><vector name='forceField.orientation' x='30' y='0' z='0'/></code>+  * Restriction: At least ''0'' 
 +  * Example (*.deeclass) <code xml><float name='forceField.radius'>2</float></code>
  
-===== bone ===== +===== shape ===== 
-Set bone to attach resource to. If empty string attach to collider. +Set shape from which the force originates. If not set force originates from origin position. 
-  * Full name: ''forceField.bone'' or ''forceField({id}).bone'' +  * Full name: ''forceField.shape'' or ''forceField({id}).shape'' 
-  * Type: string+  * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString.
   * Default Value: empty string   * Default Value: empty string
-  * Example (*.deeclass) <code xml><string name='forceField.bone'>attach</string></code>+  * Example (*.deeclass) <code xml><string name='forceField.shape'>box:position,0,0.5,0:extends,2,1,0.5</string></code>
  
 ===== trigger ===== ===== trigger =====
Line 166: Line 174:
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
-|enabled|true,false|Enable force field|+|enabled|''true'', ''false''|Enable force field|
  
 This is an example of using this action: This is an example of using this action:
Line 180: Line 188:
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
-|enabled|true,false|Force field is enabled or not|+|enabled|''true'', ''false''|Force field is enabled or not| 
 +|wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled|
  
 This is an example of using this action: This is an example of using this action:
Line 198: Line 207:
 ===== forceField.check ===== ===== forceField.check =====
  
-Check one or more force field parameters. Conditions returns true if all parameter value match their respective force field parameter. This condition is typically used to run an action or sequence of actions as long as a force field condition is true.+Check one or more force field parameters. Conditions returns true if all parameter value match their respective force field parameter. This condition is typically used to run an action or sequence of actions as long as force field conditions are true.
  
 ^Parameter^Value^Description^ ^Parameter^Value^Description^
-|forceField.enabled|true,false|Force field is enabled or not|+|forceField.enabled|''true'', ''false''|Force field is enabled or not|
  
 This is an example of using this condition: This is an example of using this condition:
Line 210: Line 219:
 </action> </action>
 </code> </code>
 +
 +====== State Machine Actions ======
 +
 +Same as [[#behavior_tree_actions|Behavior Tree Actions]].
 +
 +====== State Machine Conditions ======
 +
 +Same as [[#behavior_tree_conditions|Behavior Tree Conditions]].
 +
 +====== State Machine Events ======
 +
 +This behavior sends these state machine events. If behavior has non-empty identifier replace ''forceField'' with ''forceField(id)''.
 +
 +===== forceField.enabled =====
 +
 +Force field has been enabled.
 +
 +===== forceField.disabled =====
 +
 +Force field has been disabled.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 218: Line 247:
  
   * [[behavior_collider|ECBehaviorCollider]]: Attach force field to collider.   * [[behavior_collider|ECBehaviorCollider]]: Attach force field to collider.
 +  * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.
 +  * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.
 +
  
 ====== Persistency ====== ====== Persistency ======
Line 260: Line 292:
      
   <behavior type='ECBehaviorForceField'>   <behavior type='ECBehaviorForceField'>
-    <!-- optional: set collision filter. default value '6:0 1 2 3 5' which means 
-                   category BaseGameApp.CollisionFilterBit.forceField 
-                   filter BaseGameApp.CollisionFilterBit.geometry, 
-                          BaseGameApp.CollisionFilterBit.dynamic, 
-                          BaseGameApp.CollisionFilterBit.actor, 
-                          BaseGameApp.CollisionFilterBit.actorAI, 
-                          BaseGameApp.CollisionFilterBit.particle. 
-                   format is '', 'category' or 'category:filter' where category and filter 
-                   are a list of bits to set. --> 
-    <string name='collisionFilter'>6:0 1 2 3 5</string> 
-     
     <!-- optional: use BaseGameApp trigger table. game can add more     <!-- optional: use BaseGameApp trigger table. game can add more
                    supported values. default value is 'default' -->                    supported values. default value is 'default' -->
Line 282: Line 303:
     <string name='trigger.synchronize'>other</string>     <string name='trigger.synchronize'>other</string>
          
-    <!-- optional: use behavior tree with id instead of empty string --> +    <!-- optional: add behavior trees. default adds all behavior trees. --> 
-    <string name='behaviorTree'>second</string>+    <list name='behaviorTrees'> 
 +      <string/> <!-- add behavior with empty identifier --> 
 +      <string>default</string> <!-- add behavior with 'default' identifier --> 
 +    </list> 
 +     
 +    <!-- optional: add state machines. default adds all state machines. --> 
 +    <list name='stateMachines'> 
 +      <string/> <!-- add behavior with empty identifier --> 
 +      <string>default</string> <!-- add behavior with 'default' identifier --> 
 +    </list>
          
     <!-- set element properties. omit property prefix if used inside behavior tag -->     <!-- set element properties. omit property prefix if used inside behavior tag -->
dragengine/modules/dragonscript/behavior_forcefield.1746043184.txt.gz · Last modified: by dragonlord