User Tools

Site Tools


dragengine:modules:dragonscript:abstractions

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
dragengine:modules:dragonscript:abstractions [2020/04/03 10:21] – url move dragonlorddragengine:modules:dragonscript:abstractions [2020/05/05 20:16] dragonlord
Line 66: Line 66:
     public func new() super("MyTrainTest")     public func new() super("MyTrainTest")
         // create visual appearance with default model(mesh), skin and rig. the rig is used both for         // create visual appearance with default model(mesh), skin and rig. the rig is used both for
-        // physical interaction and animation purpose +        // physical interaction and animation purpose. this method assigns the resources located 
-        component = ECBehaviorComponent.new(this) +        // in the common directory "/content/train" 
-        component.getComponent().getModel().setPath("/content/train/train.demodel") +        component.setCommonPath("/content/train", "train.demodel", "train.deskin", "train.derig")
-        component.getComponent().getSkin().setPath("/content/train/train.deskin"+
-        component.getComponent().getRig().setPath("/content/train/train.derig")+
                  
-        // create collider which is used for physical interaction +        // create collider which is used for physical interaction. in most situations you want to 
-        collider = ECBehaviorCollider.new(this)+        // animate the component with the rig. this requires to component behavior to go first 
 +        collider = ECBehaviorCollider.new(this, component)
                  
-        // create head lights. attached to collider defined above +        // create head lights. attached to collider with id "headlightLeft" respectively "headlightRight" 
-        headLightLeft = ECBehaviorLight.new(this) +        headLightLeft = ECBehaviorLight.new(this, collider, "headlightLeft"
-        headLightLeft.getLight().getColor().setColor(Color.YELLOW+        headLightLeft.getLight().getColor().setColor(Color.yellow
-        headLightLeft.getAttach().getPosition().setVector(Vector.new(-1.0, 0.5, 2.0))+        headLightLeft.getAttach().getPosition().setVector(Vector.new(-1, 0.5, 2))
                  
-        headLightRight = ECBehaviorLight.new(this) +        headLightRight = ECBehaviorLight.new(this, collider, "headlightRight"
-        headLightRight.getLight().getColor().setColor(Color.YELLOW+        headLightRight.getLight().getColor().setColor(Color.yellow
-        headLightRight.getAttach().getPosition().setVector(Vector.new(1.0, 0.5, 2.0))+        headLightRight.getAttach().getPosition().setVector(Vector.new(1, 0.5, 2))
                  
-        // create engine speaker. attached to the collider defined above +        // create engine speaker. attached to the collider 
-        speaker = ECBehaviorSpeaker.new(this)+        speaker = ECBehaviorSpeaker.new(this, collider)
         speaker.getSpeaker().getSound().setPath("/content/train/engine.ogg")         speaker.getSpeaker().getSound().setPath("/content/train/engine.ogg")
         speaker.getAttach().getPosition().setVector(Vector.new(0.0, 0.5, 1.5))         speaker.getAttach().getPosition().setVector(Vector.new(0.0, 0.5, 1.5))
                  
-        // create behavior animating the visual appearance using an animator +        // create behavior animating the visual appearance (component) using an animator 
-        animated = ECBehaviorAnimated.new(this)+        animated = ECBehaviorAnimated.new(this, component)
         animated.getAnimator().getAnimator().setPath("/content/train/train.deanimator")         animated.getAnimator().getAnimator().setPath("/content/train/train.deanimator")
                  
-        // create behavior moving collider on rail. the mapper defines what rail to use +        // create behavior moving collider on rail. the mapper defines what rail to use
-        moveOnRail = ECBehaviorMoveOnRail.new(this)+        // if you assign also the trigger system from the BaseGameApp then the mapper 
 +        // can use triggers to start/stop moving the train. if you want to control this 
 +        // on your own (or by other behaviors only) leave out this argument 
 +        moveOnRail = ECBehaviorMoveOnRail.new(this, collider, BaseGameApp.getApp().getTriggerSystem())
    end    end
 end end
dragengine/modules/dragonscript/abstractions.txt · Last modified: 2024/03/14 16:43 by dragonlord