Scripting
import "aego/camera"
func OnCollisionEnter(other NodeRef, c physics.Contact) {
if c.Normal.Y < -0.5 && c.NormalImpulse > 8 {
camera.Shake(0.35)
}
}
func Boss() coroutine {
yield camera.BlendTo(BossCam, 1.5)
yield waitSeconds(3)
camera.Release(0)
}
| Function | |
|---|---|
Active() NodeRef, ActiveOn(output) NodeRef |
the virtual camera that drives an output |
BlendTo(camera, seconds) Blend |
make a camera active over priorities and blend to it; 0 uses its Blend Time |
Cut(camera) |
the same without a blend |
Release(seconds) Blend |
hand the main output back to priorities |
Shake(trauma), ShakeOn(output, trauma) |
add trauma |
Trauma() float |
trauma of the main output |
LogicalPose() Pose |
pose without shake and pixel snapping |
RenderPose() Pose |
pose the main output was drawn with |
ScreenToWorld(p), WorldToScreen(p) |
conversions with the last drawn view, in output pixels |
Blend has Done(), Running(), Stop() and the signal Completed(finished bool); yield waits for it. Component methods: VirtualCamera2D.IsActive(), CameraFollow2D.Snap() and CameraShake2D.Add(trauma).
Each output keeps its own trauma:
package demo
import (
"aego/camera"
"aego/log"
)
script Outputs {
func Ready() {
camera.Shake(0.3)
camera.ShakeOn("map", 0.9)
log.Info("main " + string(camera.Trauma()))
log.Info("active camera is nil: " + string(camera.Active() == nil))
}
}