Skip to content

Game.SnapLine

Assembly: Assembly-CSharp
Namespace: Game.Tools

Type: struct

Base: System.ValueType

Summary:
Represents a snap line used by in-game tools to assist placement/ snapping along a curve. A SnapLine bundles a control point (the snap origin or handle), a cubic Bezier curve (Bezier4x3) that defines the line in world space, flags that modify snapping behavior (SnapLineFlags), and a height weight used to bias selection based on vertical positioning.


Fields

  • public ControlPoint m_ControlPoint
    Holds the ControlPoint associated with this snap line. The control point typically encodes the world position and orientation (and potentially other metadata) used as the reference for snapping.

  • public Bezier4x3 m_Curve
    A cubic Bezier curve (4 control points × 3 components) that represents the geometric shape of the snap line in world coordinates. Tools use this curve to find nearest points, project positions, or guide placement along a smooth path.

  • public SnapLineFlags m_Flags
    Flags that modify the behavior of the snap line. SnapLineFlags is an enum that can indicate properties such as whether the line is enabled, if it is one-way, whether it prefers horizontal/vertical snapping, or other tool-specific behaviors. Check the SnapLineFlags enum for available flag values and their meanings.

  • public float m_HeightWeight
    A floating-point weight used to bias or influence snapping decisions based on height. Larger values increase the importance of vertical alignment or preference when resolving multiple candidate snap lines.

Properties

  • This type has no properties.

Constructors

  • public SnapLine(ControlPoint position, Bezier4x3 curve, SnapLineFlags flags, float heightWeight)
    Initializes a new SnapLine instance.

  • position: The ControlPoint to associate with this snap line (reference/origin).

  • curve: The Bezier4x3 curve describing the snap line geometry.
  • flags: SnapLineFlags value controlling snapping behavior.
  • heightWeight: Float weight used to bias snap selection by height.

Methods

  • This type defines no methods (instance or static). It is a plain data container (struct) used by tools and systems that perform snapping and placement logic. All behavior is implemented externally by tool/manager code that consumes SnapLine instances.

Usage Example

// Construct a SnapLine for a tool
ControlPoint cp = new ControlPoint {
    // initialize cp fields: position, tangent, etc.
};

Bezier4x3 curve = new Bezier4x3(
    p0: new Vector3(0, 0, 0),
    p1: new Vector3(10, 0, 0),
    p2: new Vector3(20, 0, 0),
    p3: new Vector3(30, 0, 0)
);

SnapLineFlags flags = SnapLineFlags.Enabled; // example flag
float heightWeight = 1.0f;

SnapLine snap = new SnapLine(cp, curve, flags, heightWeight);

// Example usage: a tool could query the curve for the closest point
// and use m_HeightWeight to resolve conflicts between multiple snap lines.