Class LegionTurns
- Namespace
- PixelUnitStudio
- Assembly
- PixelUnitStudio.Runtime.dll
Instead of rotating weapon art, swaps in whichever pre-rotated clean art (turns, counter-clockwise k×step°) is closest to the weapon angle. Rotating pixel art at an arbitrary angle at runtime breaks outlines and drops or overlaps pixels (tools/generate_weapon_turns.py). Attached to a renderer that is a child of the weapon bone. The motion decides the bone rotation as is, and this renderer cancels that rotation and changes only the art's direction.
public sealed class LegionTurns : MonoBehaviour
- Inheritance
-
LegionTurns
Constructors
LegionTurns()
public LegionTurns()
Fields
hold
Held angle (degrees, 0 = horizontal forward, + is forward-down). With keepAngle it is an angle relative to the rig root, otherwise it is added to the bone angle.
public float hold
Field Value
keepAngle
Fixes the art direction to hold even when the arm (bone) turns. Used for non-attacking off-hand attachments.
public bool keepAngle
Field Value
lift
Distance (px) lifted upward on screen when keepAngle is on.
public float lift
Field Value
turns
public Sprite[] turns
Field Value
- Sprite[]
Methods
Apply()
Switches to the art matching the current bone angle. Also call it after sampling the animation directly (sheet export, etc.).
public void Apply()
ApplyAll(GameObject)
Fits every LegionTurns under root to the current pose.
public static void ApplyAll(GameObject root)
Parameters
rootGameObject