This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
dragengine:modules:dragonscript:abstractions [2020/04/03 10:21] – url move dragonlord | dragengine:modules:dragonscript:abstractions [2020/05/05 20:16] – dragonlord | ||
---|---|---|---|
Line 66: | Line 66: | ||
public func new() super(" | public func new() super(" | ||
// create visual appearance with default model(mesh), | // create visual appearance with default model(mesh), | ||
- | // physical interaction and animation purpose | + | // physical interaction and animation purpose. this method assigns the resources located |
- | component = ECBehaviorComponent.new(this) | + | |
- | | + | component.setCommonPath("/ |
- | component.getComponent().getSkin().setPath("/ | + | |
- | component.getComponent().getRig().setPath("/ | + | |
| | ||
- | // 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 | + | // create head lights. attached to collider |
- | headLightLeft = ECBehaviorLight.new(this) | + | headLightLeft = ECBehaviorLight.new(this, collider, " |
- | 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, |
| | ||
- | headLightRight = ECBehaviorLight.new(this) | + | headLightRight = ECBehaviorLight.new(this, collider, " |
- | 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, |
| | ||
- | // create engine speaker. attached to the collider | + | // create engine speaker. attached to the collider |
- | speaker = ECBehaviorSpeaker.new(this) | + | speaker = ECBehaviorSpeaker.new(this, collider) |
speaker.getSpeaker().getSound().setPath("/ | speaker.getSpeaker().getSound().setPath("/ | ||
speaker.getAttach().getPosition().setVector(Vector.new(0.0, | speaker.getAttach().getPosition().setVector(Vector.new(0.0, | ||
| | ||
- | // create behavior animating the visual appearance using an animator | + | // create behavior animating the visual appearance |
- | animated = ECBehaviorAnimated.new(this) | + | animated = ECBehaviorAnimated.new(this, component) |
animated.getAnimator().getAnimator().setPath("/ | animated.getAnimator().getAnimator().setPath("/ | ||
| | ||
- | // 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 |