Instance Transform
Represents an instance’s position, rotation, and scale
This struct is used throughout Flora to describe the transform of an instance either relative to a parent (local space) or in world space when no parent is defined. Most of its API is derived from the entities package struct: LocalTransform.
Usage
Defining an Instance Transform
Instances are placed using local transform data relative to a parent:
var localTransform = new FloraInstanceTransform(localPosition, localRotation, localScale);
FloraSystem.Instance.CreateInstance(prefab, this.transform, localTransform);
Converting from a Unity Transform
You can construct a FloraInstanceTransform
from a Transform
in either local or world space:
var local = FloraInstanceTransform.FromUnityTransform(this.transform, Space.Self);
var world = FloraInstanceTransform.FromUnityTransform(this.transform, Space.World);
Writing Instance Transforms
Transforms can be applied to an existing instance:
FloraSystem.Instance.UpdateInstanceWorldTransform(handle, transform);
Transform Composition and Manipulation
The struct supports applying translations, rotations, and scaling directly:
transform = transform.RotateY(math.radians(90)).Translate(new float3(0, 1, 0));
Last updated