transform

package
v1.15.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: CC0-1.0, MIT Imports: 5 Imported by: 17

Documentation

Overview

This code is adapted from https://github.com/m110/airplanes (author: m110)

Index

Constants

This section is empty.

Variables

View Source
var HierarchySystem = &hierarchySystem{
	query: donburi.NewQuery(filter.Contains(hierarchyParentComponent)),
}

HierarchySystem is a system that removes children of invalid parents.

View Source
var Transform = donburi.NewComponentType[TransformData](defaultValue)

Functions

func AppendChild

func AppendChild(parent, child *donburi.Entry, keepWorldPosition bool)

AppendChild appends child to the entry.

func ChangeParent added in v1.3.10

func ChangeParent(child, parent *donburi.Entry, keepWorldPosition bool)

ChangeParent changes parent of the entry.

func FindChildWithComponent

func FindChildWithComponent(entry *donburi.Entry, componentType donburi.IComponentType) (*donburi.Entry, bool)

FindChildWithComponent finds child with specified component.

func GetChildren added in v1.2.19

func GetChildren(entry *donburi.Entry) ([]*donburi.Entry, bool)

GetChildren returns children of the entry.

func GetParent added in v1.2.19

func GetParent(entry *donburi.Entry) (*donburi.Entry, bool)

GetParent returns parent of the entry.

func LookAt

func LookAt(entry *donburi.Entry, target dmath.Vec2)

LookAt looks at the target.

func RemoveChildrenRecursive added in v1.2.19

func RemoveChildrenRecursive(entry *donburi.Entry)

RemoveChildrenRecursive removes children recursively.

func RemoveParent added in v1.3.10

func RemoveParent(entry *donburi.Entry, keepWorldPosition bool)

RemoveParent removes parent of the entry.

func RemoveRecursive added in v1.2.19

func RemoveRecursive(entry *donburi.Entry)

RemoveRecursive removes the entry and its children recursively.

func Reset added in v1.2.19

func Reset(entry *donburi.Entry)

Reset resets the entry's transform component to default value.

func Right(entry *donburi.Entry) dmath.Vec2

Right returns right vector of the entry.

func SetParent

func SetParent(entry, parent *donburi.Entry, keepWorldPosition bool)

SetParent sets parent to the entry.

func SetWorldPosition

func SetWorldPosition(entry *donburi.Entry, pos dmath.Vec2)

SetWorldPosition sets world position to the entry.

func SetWorldRotation

func SetWorldRotation(entry *donburi.Entry, rotation float64)

SetWorldRotation sets world rotation to the entry.

func SetWorldScale added in v1.2.18

func SetWorldScale(entry *donburi.Entry, scale dmath.Vec2)

SetWorldScale sets world scale to the entry.

func Up

func Up(entry *donburi.Entry) dmath.Vec2

Up returns up vector of the entry.

func WorldPosition

func WorldPosition(entry *donburi.Entry) dmath.Vec2

WorldPosition returns world position of the entry.

func WorldRotation

func WorldRotation(entry *donburi.Entry) float64

WorldRotation returns world rotation of the entry.

func WorldScale

func WorldScale(entry *donburi.Entry) dmath.Vec2

WorldScale returns world scale of the entry.

Types

type TransformData

type TransformData struct {
	LocalPosition dmath.Vec2
	LocalRotation float64
	LocalScale    dmath.Vec2
	// contains filtered or unexported fields
}

TransformData is a data of transform component.

func GetTransform

func GetTransform(entry *donburi.Entry) *TransformData

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳