Get RAPTOR

RaptorSuitePlayerReference

Places, frames and removes the scene's Player Reference.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Each scene has one reference. Placing it when the active scene already has one moves it and removes any extra copies, such as a Hierarchy duplicate, in one Undo step.

The model is the player profile's humanoid body model (RaptorPlayerProfiles), taken from the Animator's source model so a rebake picks up a new player model. It is posed in the Animator controller's default idle and baked into one static mesh asset (ResolvedMeshPath). Its lowest vertex sits at height 0, so the prefab root is the foot point. Without a humanoid profile, the built-in mannequin is used (RaptorPlayerMannequin, MannequinPath). The mesh is baked on first use, and Tools → RAPTOR → Rebake Player Reference rebuilds it.

The reference uses the "RAPTOR/Player Reference" material (ResolvedMaterialPath), casts no shadows, uses no light or reflection probes and has no static flags, so bakes ignore it. It is tagged EditorOnly. Scene picking is off on the model, so clicks and tool surface picks reach the level behind it. To work with it, use its Hierarchy row, the band's Find and Remove, or place it again.

Its gizmo is a facing arrow on the floor and an eye ring at the player's camera height, labelled in metres. The gizmo shows while the reference is selected, or while a tool registered with RegisterShowAll is equipped.

public static class RaptorSuitePlayerReference

Fields

Glyph

public const string Glyph;

The Player mode's glyph.

Properties

CurrentTextured

public static bool CurrentTextured { get; }

Whether the active scene's reference shows the player's textures. False when there is no reference.

Exists

public static bool Exists { get; }

Whether the active scene has an enabled reference. Reads the live registry without searching the scene, so it is cheap to read on every repaint.

GhostHeight

public static float GhostHeight { get; }

The ghost's height: the baked model's height, or else the profile's standing height.

Methods

DrawGhost

public static void DrawGhost(Vector3 feet, Quaternion facing, Color ink, bool model)

Draws the placing ghost at a pose: the see-through model, the body outline and the facing arrow.

ParameterTypeDescription
feetVector3The world point of the feet.
facingQuaternionThe rotation whose yaw the figure faces.
inkColorThe outline and arrow colour.
modelboolWhether to draw the see-through model (3D only).

Frame

public static bool Frame()

Frames the reference in the RAPTOR view, or else in the last Scene view.

Returns: False when there is no reference.

Place

public static RaptorPlayerReference Place(Vector3 feet, Quaternion facing)

Places the active scene's reference at feet, facing the yaw of facing, and selects it. Creates the reference when there is none; otherwise moves it and removes extra copies. Uses one Undo step.

ParameterTypeDescription
feetVector3The world point of the feet.
facingQuaternionThe rotation whose yaw the figure faces.

Returns: The reference, or null in Play mode or when the model or material is missing.

RegisterShowAll

public static void RegisterShowAll(string id, System.Func<bool> showAll)

Shows every reference's gizmo while showAll returns true, for example while a tool that works with the reference is equipped. Calling again with the same id replaces the earlier predicate. A predicate that throws is logged once and treated as false.

ParameterTypeDescription
idstringThe registration's stable id.
showAllSystem.Func<bool>Returns true while every reference's gizmo should show.

Call from an [InitializeOnLoad] static constructor on the main thread.

Remove

public static bool Remove()

Removes the active scene's reference, including any copies, in one Undo step.

Returns: False when there was none.

SetTextured

public static bool SetTextured(bool textured)

The reference always shows the Solid look; the Textured look is not offered. false puts an older reference saved with the textured look back to Solid, in one Undo step. true does nothing.

ParameterTypeDescription
texturedboolOnly false has an effect: the Solid look.

Returns: False when there is no reference or nothing changed.

UnregisterShowAll

public static void UnregisterShowAll(string id)

Removes a RegisterShowAll registration.

ParameterTypeDescription
idstringThe registration's stable id.