User Tools

Site Tools


dragengine:modules:dragonscript:behavior_attachable_randomizegeometry

This is an old revision of the document!


ECABehaviorRandomizeGeometry

Attachable element behavior randomizing geometry of element.

Upon adding the behavior to an element the geometry of the element is randomized. After this point the behavior has no effect anymore and can be removed if desired.

Main use for this behavior though is using attachable behavior factory by adding the behavior to an element in the world editor. Used this way the randomization is applied during factory create behavior call without actually adding the behavior to the element. This way the randomization is applied once during element instantiation without keeping the behavior around. Randomization uses element stub properties with prefix randomizeGeometry.. Randomization is applied relative to the current element geometry.

Element Class Properties

Element class properties have the prefix randomizeGeometry..

position

Move element by a random amount from the range -position to position. Movement is done in world space.

  • Full name: randomizeGeometry.position
  • Type: 3-point float vector
  • Default value: (0, 0, 0)
  • Example (*.deeclass):
    <vector name='randomizeGeometry.position' x='0.2' y='0' z='0.2'/>

positionMinimum

Move element by a random amount from the range -positionMinimum to positionMaximum. If present randomizeGeometry.position is ignored. Movement is done in world space.

  • Full name: randomizeGeometry.positionMinimum
  • Type: 3-point float vector
  • Default value: (0, 0, 0)
  • Example (*.deeclass):
    <vector name='randomizeGeometry.positionMinimum' x='-0.2' y='0' z='-0.2'/>

positionMaximum

Move element by a random amount from the range -positionMinimum to positionMaximum. If present randomizeGeometry.position is ignored. Movement is done in world space.

  • Full name: randomizeGeometry.positionMaximum
  • Type: 3-point float vector
  • Default value: (0, 0, 0)
  • Example (*.deeclass):
    <vector name='randomizeGeometry.positionMaximum' x='0.2' y='0' z='0.2'/>

rotation

Rotate element by a random amount in degrees from the range -rotation to rotation. Rotation is done in world space.

  • Full name: randomizeGeometry.rotation
  • Type: 3-point float vector
  • Default value: (0, 0, 0)
  • Example (*.deeclass):
    <vector name='randomizeGeometry.shift' x='0' y='20' z='0'/>

rotationMinimum

Rotate element by a random amount in degrees from the range -rotationMinimum to rotationMaximum. If present randomizeGeometry.rotation is ignored. Rotation is done in world space.

  • Full name: randomizeGeometry.rotationMinimum
  • Type: 3-point float vector
  • Default value: (0, 0, 0)
  • Example (*.deeclass):
    <vector name='randomizeGeometry.rotationMinimum' x='' y='-20' z='0'/>

rotationMaximum

Rotate element by a random amount in degrees from the range -rotationMinimum to rotationMaximum. If present randomizeGeometry.rotation is ignored. Rotation is done in world space.

  • Full name: randomizeGeometry.rotationMaximum
  • Type: 3-point float vector
  • Default value: (0, 0, 0)
  • Example (*.deeclass):
    <vector name='randomizeGeometry.rotationMaximum' x='0' y='20' z='0'/>

scale

Uniformly scale element by a random amount from the range 1 - scale to 1 + scale. The value is thus the percentage to increase/decrease the scaling. For example a value of 0.1 increases/decreases the scaling of the element by up to 10%.

  • Full name: randomizeGeometry.scale
  • Type: float
  • Default value: 0
  • Example (*.deeclass):
    <float name='randomizeGeometry.scale'>0.1</float>

scaleMinimum

Uniformly scale element by a random amount from the range 1 + scaleMinimum to 1 + scaleMaximum. The value is thus the percentage to increase/decrease the scaling. For example a value of 0.1 increases/decreases the scaling of the element by up to 10%. If present randomizeGeometry.scale is ignored.

  • Full name: randomizeGeometry.scaleMinimum
  • Type: float
  • Default value: 0
  • Example (*.deeclass):
    <float name='randomizeGeometry.scaleMinimum'>-0.1</float>

scaleMaximum

Uniformly scale element by a random amount from the range 1 + scaleMinimum to 1 + scaleMaximum. The value is thus the percentage to increase/decrease the scaling. For example a value of 0.1 increases/decreases the scaling of the element by up to 10%. If present randomizeGeometry.scale is ignored.

  • Full name: randomizeGeometry.scaleMaximum
  • Type: float
  • Default value: 0
  • Example (*.deeclass):
    <float name='randomizeGeometry.scaleMaximum'>-0.1</float>

Required Behaviors

This behavior does not required other behaviors.

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

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

API Documentation

ECABehaviorRandomizeGeometry.

Since DragonScript Module Version 1.29

Use Cases

  • Randomize scaling and rotation of elements to make worlds less uniform.
You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_attachable_randomizegeometry.1761669121.txt.gz · Last modified: 2025/10/28 16:32 by dragonlord