User Tools

Site Tools


dragengine:modules:dragonscript:behavior_nstategeometry

ECBehaviorNStateGeometry

Behavior element behavior adding geometry network state support.

If ECBehaviorNetworkState is present and activate adds network values to synchronize the owner element position and orientation.

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix nstateGeometry. .

Events

This behavior has no events.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does not required element class to be persistable (setPersistable).

API Documentation

ECBehaviorNStateGeometry.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

This example defines an element which synchronizes geometry state of element using network state.

class MyElement extends BehaviorElementClass
  public var ECBehaviorNetworkState networkState
  public var ECBehaviorNStateGeometry nstateGeometry
  func new()
    networkState = ECBehaviorComponent.new(this, 1, 1)
    nstateGeometry = ECBehaviorNStateGeometry.new(this, networkState)
  end
end

Behavior Factory

Using element class supporting adding behaviors the behavior can be added like this:

<?xml version='1.0' encoding='UTF-8'?>
<elementClass name='MyClass' class='GenericBehaviorElement'>
  <behavior type='ECBehaviorNetworkState'>
    <integer name='requestLinkCode'>1</integer>
    <integer name='messageCode'>1</integer>
  </behavior>
 
  <behavior type='ECBehaviorNStateGeometry'>
    <!-- optional: position precision. default is 0.001 -->
    <float name='precisionPosition'>0.01</float>
 
    <!-- optional: orientation precision. default is 0.001 -->
    <float name='precisionOrientation'>0.01</float>
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.name'>value</string>
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_nstategeometry.txt · Last modified: 2025/03/12 22:08 by dragonlord