User Tools

Site Tools


dragengine:modules:dragonscript:behavior_decal

ECBehaviorDecal

Behavior element behavior adding decal projected onto ECBehaviorComponent.

Instance Counts

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

Element Class Properties

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

position

Set position relative to component to project decal from.

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

orientation

Set orientation relative to component to project decal from.

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

size

Set size of decal to project. The X and Y coordinates are the size of the decal. The Z coordinate is the projection distance. The decal does not apply beyond this distance.

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

skin

Set path of skin resource to use.

  • Full name: decal.skin or decal({id}).skin
  • Type: string
  • Default Value: empty string
  • Expected File Type: *.deskin
  • Example (*.deeclass)
    <string name='decal.skin'>box.deskin</string>

Events

This behavior has no events.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

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

API Documentation

ECBehaviorDecal.

Since DragonScript Module Version 1.0

Use Cases

  • Add decal to component.

Element Class Example

This example defines an element which adds a decal to the component.

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorDecal decal
  func new()
    // add component to add decal to
    component = ECBehaviorComponent.new(this)
    
    // add decal. it will only show on this component. you can add multiple decals
    // to the same component or to different components
    decal = ECBehaviorDecal.new(this, component)
    decal.getSkin().setPath("/content/decals/mark.deskin")
  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'>
  <!-- add component to add decal to -->
  <behavior type='ECBehaviorComponent'/>
 
  <!-- add decal to component -->
  <behavior type='ECBehaviorDecal'>
    <!-- optional: use component with id instead of empty string -->
    <!-- <string name='component'>second</string> -->
 
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.skin'>mark.deskin</string>
  </behavior>
 
  <!-- for adding multiple behaviors use unique identifiers -->
  <behavior type='ECBehaviorDecal' id='second'>
    ...
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_decal.txt · Last modified: 2025/03/13 17:06 by dragonlord