Code Reference‎ > ‎

Class Structure

This page documents the class structure and what is added at each level. This is important when adding new constraints.

The indentation displayed using bullet-points denotes inheritance.
  • ConstraintFrameworkBaseClass - Contains the basic functionality for solid and robust operation of all constraints. This includes:
      - The cache of the transform in this.xform
      - OnEnable, OnDisable and InitConstraint which manage the constraint co-routine
      - The Constrain() co-routine which triggers the event OnConstraintUpdate().
    • TurnTableConstraint - This doesn't use a target so it inherits directly from the framework for the most basic behavior

    • ConstraintBaseClass - Adds the target Transform reference and constraint MODE_OPTIONS and mode handling.

      • TransformConstraint - Adds position, rotation, scale and SetWorldScale(), a custom method for referencing the target's scale in world-space without hierarchy iterations or the use of lossyScale.

      • LookAtBaseClass - Used by the 'LookAt' family of constraints to implement user-defined axis choices. This includes:
          - The pointAxis and upAxis Vector3s for internal use only (not by derived classes)
          - DoLookAt() - takes a Unity-standard forward/up look rotation and adjusts for user input

        • LookAtConstraint - Implements the  OnConstraintUpdate() functionality
            - Adds an optional upTarget Transform reference for the up axis to point at.

        • BillboardConstraint - Adds the option to not billboard vertically (only rotate around the up vector rather than parallel to the target up vector). Billboarding also does not point at the target directly, but rather points in a vector parallel to the inverse of the direction the target is pointing (they point in a parallel direction toward each other)