SpriteFactory.Sprite.Locator
Class
A locator is a Transform that you can animate frame-by-frame. They are useful for things like bullet or muzzle flash origin points, attaching an object to a specific point on a sprite, and more. You can define any number of locators for your sprite and animate them to match the animation of your sprite. Example: A character holding a gun as a separate sprite. The gun can be parented to a locator positioned on the character's hand that animates frame-by-frame rotating the gun to match the sprite animation. Rotation of the gun can be animated using the facing property of the locator.
See Locators for more information about Locators in general.
Properties |
||||
Name | Type | Description | ||
name | string | The name of the locator. (Read-Only) | ||
active | bool | Is the locator GameObject active? (Read-Only) | ||
Functions |
||||
Name | Description | |||
AttachChild | Parent an object to this locator. | |||
DetachChild | Unparent a child object of this locator. | |||
ScaleChild | Scale a child of this locator. | |||
Internal Use Functions | You will probably never need to call any of these functions. | |||
SetActive | Set active state on the locator. | |||
SetActiveRecursively | Set active state on the locator and any children. | |||
BatchScaleChildren | Batch scale all children of locator. |
Transform Properties
Each of these properties corresponds to a property in Transform. Use these to access information in the locator's Transform.
Note: These properties are identical to their Transform counterparts, therefore the documentation pages link to the Transform versions.
Name | Type | Description | ||
position | Vector3 | The position of the transform in world space. | ||
localPosition | Vector3 | Position of the transform relative to the parent transform. | ||
rotation | Quaternion | The rotation of the transform in world space stored as a Quaternion. | ||
localRotation | Quaternion | The rotation of the transform relative to the parent transform's rotation. | ||
eulerAngles | Vector3 | The rotation as Euler angles in degrees. | ||
localEulerAngles | Vector3 | The rotation as Euler angles in degrees relative to the parent transform's rotation. | ||
localScale | Vector3 | The scale of the transform relative to the parent. | ||
lossyScale | Vector3 | The global scale of the object (Read Only). | ||
right | Vector3 | The red axis of the transform in world space (Read Only). | ||
up | Vector3 | The green axis of the transform in world space (Read Only). | ||
forward | Vector3 | The blue axis of the transform in world space (Read Only). | ||
worldToLocalMatrix | Matrix4x4 | Matrix that transforms a point from world space into local space (Read Only). | ||
localToWorldMatrix | Matrix4x4 | Matrix that transforms a point from local space into world space (Read Only). |
Transform Functions
Each of these functions corresponds to a function in Transform. Use these to access information in the locator's Transform.
Name | Description | |
TransformDirection | Transforms direction from local space to world space. | |
InverseTransformDirection | Transforms a direction from world space to local space. The opposite of TransformDirection. | |
TransformPoint | Transforms position from local space to world space. | |
InverseTransformPoint | Transforms position from world space to local space. The opposite of TransformPoint. | |
DetachChildren | Unparents all children. |