Aego Playground

Builtin typesmodule

NodeRef.Childmethod

func (NodeRef) Child(name string) NodeRef

Child returns the direct child with this name, or nil.

Example

gun := node.Child("Gun")

NodeRef.Destroymethod

func (NodeRef) Destroy()

Destroy removes the node and its children at the end of the phase.

Example

node.Destroy()

NodeRef.Enabledmethod

func (NodeRef) Enabled() bool

Enabled reports the node's own enabled flag, ignoring its parents.

Example

if !Door.Enabled() {

NodeRef.Findmethod

func (NodeRef) Find(path string) NodeRef

Find resolves a path relative to the node: Weapon/Gun, ../Sibling or /Root/Player.

Example

muzzle := node.Find("Weapon/Muzzle")

NodeRef.IsAlivemethod

func (NodeRef) IsAlive() bool

IsAlive reports whether the node exists. It is false right after Destroy.

Example

if Target != nil && Target.IsAlive() {

NodeRef.Namemethod

func (NodeRef) Name() string

Name returns the node name, unique among its siblings.

Example

log.Info(node.Name())

NodeRef.Parentmethod

func (NodeRef) Parent() NodeRef

Parent returns the parent node, or nil for top-level nodes.

Example

owner := node.Parent()

NodeRef.Positionmethod

func (NodeRef) Position() Vec2

Position returns the local position relative to the parent.

Example

p := node.Position()

NodeRef.Position3method

func (NodeRef) Position3() Vec3

Position3 returns the local 3D position.

Example

p := node.Position3()

NodeRef.Rotationmethod

func (NodeRef) Rotation() float

Rotation returns the local rotation in radians, clockwise.

Example

a := node.Rotation()

NodeRef.Rotation3method

func (NodeRef) Rotation3() Quat

Rotation3 returns the local 3D rotation.

Example

q := node.Rotation3()

NodeRef.Scalemethod

func (NodeRef) Scale() Vec2

Scale returns the local scale.

Example

s := node.Scale()

NodeRef.SetEnabledmethod

func (NodeRef) SetEnabled(enabled bool)

SetEnabled turns the node on or off. Disabled nodes and their children are not drawn.

Example

Shield.SetEnabled(false)

NodeRef.SetPositionmethod

func (NodeRef) SetPosition(p Vec2)

SetPosition sets the local position.

Example

node.SetPosition(node.Position() + velocity * dt)

NodeRef.SetPosition3method

func (NodeRef) SetPosition3(p Vec3)

SetPosition3 sets the local 3D position.

Example

node.SetPosition3(node.Position3() + Vec3{0, 0, -Speed * dt})

NodeRef.SetRotationmethod

func (NodeRef) SetRotation(radians float)

SetRotation sets the local rotation in radians.

Example

node.SetRotation(node.Rotation() + Spin * dt)

NodeRef.SetRotation3method

func (NodeRef) SetRotation3(q Quat)

SetRotation3 sets the local 3D rotation.

Example

node.SetRotation3(math.QuatEuler(0, angle, 0))

NodeRef.SetScalemethod

func (NodeRef) SetScale(scale Vec2)

SetScale sets the local scale. A negative X mirrors the node.

Example

node.SetScale(Vec2{-1, 1})

NodeRef.SetTransform2Dmethod

func (NodeRef) SetTransform2D(t Transform2D)

SetTransform2D replaces the local 2D transform.

Example

node.SetTransform2D(t)

NodeRef.SetTransform3Dmethod

func (NodeRef) SetTransform3D(t Transform3D)

SetTransform3D replaces the local 3D transform.

Example

node.SetTransform3D(t)

NodeRef.Spacemethod

func (NodeRef) Space() int

Space returns 0 for 2D nodes and 1 for 3D nodes.

Example

if node.Space() == 1 {

NodeRef.Transform2Dmethod

func (NodeRef) Transform2D() Transform2D

Transform2D returns a copy of the local 2D transform. Change it and pass it to SetTransform2D.

Example

t := node.Transform2D()
t.Position.X += 1
node.SetTransform2D(t)

NodeRef.Transform3Dmethod

func (NodeRef) Transform3D() Transform3D

Transform3D returns a copy of the local 3D transform.

Example

t := node.Transform3D()
t.Position.Y += 1
node.SetTransform3D(t)

NodeRef.WorldPositionmethod

func (NodeRef) WorldPosition() Vec2

WorldPosition returns the position in world space, as of the last transform pass.

Example

d := math.Dist(node.WorldPosition(), Target.WorldPosition())