User Tools

Site Tools


dragengine:modules:dragonscript:behavior_envmapprobe

ECBehaviorEnvMapProbe

Behavior element behavior adding environment map probe support.

Attaches an EnvMapProbe resource to the behavior element.

If the ECBehaviorCollider behavior is present in the behavior element the EnvMapProbe is attached to the collider.

Instance Counts

This behavior can be used multiple times on an element to add multiple environment map probes to mainpulate. Use the behavior identifier to tell them apart.

Element Class Properties

Element class properties have the prefix envMapProbe. or envMapProbe({id}). if id is not empty.

influenceArea

Set influence shape. Geometry touching this shape is affected by this environment map probe. Has to be box shapes.

  • Full name: envMapProbe.influenceArea or envMapProbe({id}).influenceArea
  • Type: string (shape format). See “Shape List Encoding” in CodecPropertyString.
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='envMapProbe.influenceArea'>box:position,0,0.5,0:extends,2,1,0.5</string>

influenceBorderSize

Set influence border size. Geometry inside this distance from the border is faded out gradually.

  • Full name: envMapProbe.influenceBorderSize or envMapProbe({id}).influenceBorderSize
  • Type: float
  • Default Value: 0.1
  • Restriction: At least 0
  • Example (*.deeclass)
    <float name='envMapProbe.influenceBorderSize'>0.2</float>

influencePriority

Set influence priority. If multiple environment maps overlap the same geometry the influence priority decided which probe affects the geometry. Higher values win over lower values.

  • Full name: envMapProbe.influencePriority or envMapProbe({id}).influencePriority
  • Type: integer
  • Default Value: 0
  • Example (*.deeclass)
    <float name='envMapProbe.influencePriority'>10</float>

reflectionShape

Set reflection shape. Has to be a single box shape.

  • Full name: envMapProbe.reflectionShape or envMapProbe({id}).reflectionShape
  • Type: string (shape format). See “Shape List Encoding” in CodecPropertyString.
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='envMapProbe.reflectionShape'>box:position,0,0.5,0:extends,2,1,0.5</string>

reflectionMask

Set reflection mask. Cuts holes into the environment map. Useful for hallways to avoid exits looking flat. Has to be box shapes.

  • Full name: envMapProbe.reflectionMask or envMapProbe({id}).reflectionMask
  • Type: string (shape format). See “Shape List Encoding” in CodecPropertyString.
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='envMapProbe.reflectionMask'>box:position,0,0.5,0:extends,2,1,0.5</string>

position

Set position to attach resource to collider.

  • Full name: envMapProbe.position or envMapProbe({id}).position
  • Type: 3-component float vector
  • Default Value: (0,0,0)
  • Example (*.deeclass)
    <vector name='envMapProbe.position' x='0' y='0' z='0.1'/>

orientation

Set orientation to attach resource to collider in degrees.

  • Full name: envMapProbe.orientation or envMapProbe({id}).orientation
  • Type: 3-component float vector
  • Default Value: (0,0,0)
  • Example (*.deeclass)
    <vector name='envMapProbe.orientation' x='30' y='0' z='0'/>

bone

Set bone to attach resource to. If empty string attach to collider.

  • Full name: envMapProbe.bone or envMapProbe({id}).bone
  • Type: string
  • Default Value: empty string
  • Example (*.deeclass)
    <string name='envMapProbe.bone'>attach</string>

Events

This behavior has no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

Persistency

This behavior does require the element class to be persistable (setPersistable).

API Documentation

ECBehaviorEnvMapProbe.

Since DragonScript Module Version 1.0

Use Cases

  • Generate environment map probe from element position.

Element Class Example

This example defines an element which contains an environment map probe.

class MyElement extends BehaviorElementClass
  public var ECBehaviorCollider collider
  public var ECBehaviorEnvMapProbe envMapProbe
  func new()
    collider = ECBehaviorCollider.new(this, null)
    envMapProbe = ECBehaviorEnvMapProbe.new(this, collider)
    envMapProbe.getEnvMapProbe().getInfluencePriority().setValue(10)
    envMapProbe.getAttach().getPosition().setVector(Vector.new(0, 1.5, 0))
  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='ECBehaviorCollider'/>
 
  <behavior type='ECBehaviorEnvMapProbe'>
    <!-- optional: set layer mask. default value is '1' which means
                   BaseGameApp.WorldLayerBit.envmap . list contains
                   bits to set separated by whitespaces. -->
    <string name='layerMask'>0 1 4</string>
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.reflectionShape'>box:position,0,0.5,0:extends,2,1,0.5</string>
  </behavior>
 
  <!-- for adding multiple behaviors use unique identifiers -->
  <behavior type='ECBehaviorEnvMapProbe' id='second'/>
</elementClass>

Live Examples

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