User Tools

Site Tools


dragengine:modules:dragonscript:behavior_clearpath

Differences

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

Link to this comparison view

Next revision
Previous revision
dragengine:modules:dragonscript:behavior_clearpath [2020/09/20 00:09] – created dragonlorddragengine:modules:dragonscript:behavior_clearpath [2025/03/13 17:09] (current) dragonlord
Line 1: Line 1:
 {{tag>dragonscript behavior}} {{tag>dragonscript behavior}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorClearPath**+[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorClearPath**
 </WRAP> </WRAP>
  
Line 8: Line 8:
  
 ====== ECBehaviorClearPath ====== ====== ECBehaviorClearPath ======
 +
 +<WRAP center 100%>
 +<WRAP center box 450px>
 +{{youtube>BbP-lMrr0tQ?medium}}
 +<WRAP centeralign>Behavior in action</WRAP>
 +</WRAP>
 +</WRAP>
  
 Behavior adding support to actors to make other actors get out of the way. Behavior adding support to actors to make other actors get out of the way.
Line 19: Line 26:
 To use this behavior add it to the element class and make sure to call setShapeSphere() to set up the collision test shapes. The best time to do this is either in BehaviorElement.init() or inside BaseActorAction if you need to change them per action. To use this behavior add it to the element class and make sure to call setShapeSphere() to set up the collision test shapes. The best time to do this is either in BehaviorElement.init() or inside BaseActorAction if you need to change them per action.
  
-**Configurations**+//Configurations//
  
 There are usually two possible configurations used for this behavior. There are usually two possible configurations used for this behavior.
Line 33: Line 40:
  
 ====== Element Class Properties ====== ====== Element Class Properties ======
-Element class properties have the prefix **clearPath.**.+Element class properties have the prefix ''clearPath.'' .
  
 ===== enabled ===== ===== enabled =====
 Determines if the behavior is initially enabled. Determines if the behavior is initially enabled.
-  * Full name: "clearPath.enabled"+  * Full name: ''clearPath.enabled''
   * Type: boolean   * Type: boolean
-  * Default Value: true+  * Default Value: ''true''
   * Example (*.deeclass) <code xml><boolean name='clearPath.enabled'>false</boolean></code>   * Example (*.deeclass) <code xml><boolean name='clearPath.enabled'>false</boolean></code>
  
 ===== checkInterval ===== ===== checkInterval =====
 Check interval in seconds. Check interval in seconds.
-  * Full name: "clearPath.checkInterval"+  * Full name: ''clearPath.checkInterval''
   * Type: floating point   * Type: floating point
-  * Minimum Value: 0 
   * Default value: 1   * Default value: 1
 +  * Restriction: At least 0
   * Example (*.deeclass) <code xml><float name='clearPath.checkInterval'>0.5</float></code>   * Example (*.deeclass) <code xml><float name='clearPath.checkInterval'>0.5</float></code>
  
Line 54: Line 61:
   * Full name: "clearPath.clearPathTime"   * Full name: "clearPath.clearPathTime"
   * Type: floating point   * Type: floating point
-  * Minimum Value: 0 
   * Default value: 0.05   * Default value: 0.05
 +  * Restriction: At least 0
   * Example (*.deeclass) <code xml><float name='clearPath.clearPathTime'>1.5</float></code>   * Example (*.deeclass) <code xml><float name='clearPath.clearPathTime'>1.5</float></code>
  
Line 65: Line 72:
  
 ====== Persistency ====== ====== Persistency ======
-This behavior does support element class to be persistable (setPersistable). Saves enabled, check interval, clear path time and the elapsed check interval time.+This behavior does support element class to be persistable (setPersistable).
  
 ====== API Documentation ====== ====== API Documentation ======
-[[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1ECBehaviorClearpath.html|ECBehaviorClearPath]].+#@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorClearpath.html,ECBehaviorClearPath~@#.
  
-Since DragonScript Module Version **1.4**+Since DragonScript Module Version ''1.4''
  
 ====== Use Cases ====== ====== Use Cases ======
Line 88: Line 95:
        
    public func new() super("ExampleElement")    public func new() super("ExampleElement")
-     // create required behaviors 
      component = ECBehaviorComponent.new(this)      component = ECBehaviorComponent.new(this)
      collider = ECBehaviorCollider.new(this, component)      collider = ECBehaviorCollider.new(this, component)
      colliderAI = ECBehaviorColliderAI.new(this, collider)      colliderAI = ECBehaviorColliderAI.new(this, collider)
      locomotion = ECBehaviorLocomotion.new(this, colliderAI)      locomotion = ECBehaviorLocomotion.new(this, colliderAI)
-      
-     // create clear path behavior. the default settings cause the element 
-     // to clear path up to a few centimeters ahead. 
      clearPath = ECBehaviorClearPath.new(this, locomotion)      clearPath = ECBehaviorClearPath.new(this, locomotion)
    end    end
 end end
 </code> </code>
 +
 +====== Behavior Factory ======
 +
 +Using element class supporting adding behaviors the behavior can be added like this:
 +<code xml>
 +<?xml version='1.0' encoding='UTF-8'?>
 +<elementClass name='MyClass' class='GenericBehaviorElement'>
 +  <behavior type='ECBehaviorComponent'/>
 +  <behavior type='ECBehaviorCollider'/>
 +  <behavior type='ECBehaviorColliderAI'/>
 +  <behavior type='ECBehaviorLocomotion'/>
 +  
 +  <behavior type='ECBehaviorClearPath'>
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <float name='.checkInterval'>1.5</float>
 +  </behavior>
 +</elementClass>
 +</code>
 +
 +====== Live Examples ======
 +
 +  * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]
 +
dragengine/modules/dragonscript/behavior_clearpath.1600560570.txt.gz · Last modified: 2020/09/20 00:09 by dragonlord