Skip to main content

GrabAssistView

A class in Root.Township, the global namespace.

Client: draws the grab assist path and target marker for one hand, using meshes and materials from GrabAssistSettings. Created with a GrabAssistController and hooked to its events.

Constructors​

MemberWhat it is
GrabAssistView(GrabAssistController controller, bool isRightHand)Creates a GrabAssistView from controller and isRightHand.

Fields​

9 private and internal fields
MemberWhat it is
private const string androidPathShaderColorPropertyColour property name on Android (_Color).
private readonly Material assistPathMaterialMaterial copy for the path dots.
private readonly Material assistTargetMaterialMaterial copy for a found target.
private readonly Material assistTargetNotFoundMaterialMaterial copy when no target is found.
private Vector3 lastFinalPathPositionIndicatorWhere the path ended last frame, so a missed path bends smoothly.
private static readonly int materialColorIdShader ID of the colour property for the platform.
private readonly Matrix4x4[] pathIndicatorPointsMatrices for each path dot, sized from assist length and interval.
private const string pcPathShaderColorPropertyColour property name on PC (_TintColor).
private readonly Vector3 targetIndicatorScaleTarget marker scale, mirrored on x for the right hand.

Properties​

2 private and internal properties
MemberWhat it is
private static Camera Camera { get; }The local player's camera, which the indicators are drawn for.
private static GrabAssistSettings Settings { get; }The global GrabAssistSettings.

Methods​

MemberWhat it is
void Disable(GrabAssistController controller)Unhooks from the controller's events and destroys the material copies.
void Enable(GrabAssistController controller)Hooks the controller's grab assist started, ended and updated events.
7 private and internal methods
MemberWhat it is
private Vector3 GetLerpedPosition(Vector3 origin, Vector3 midPoint, float linePoint, Vector3 pointPosition)Gives a path point on a curve to the last end point, smoothed, used when no target is found.
private static Vector3 GetSectionPoint(Vector3 start, Vector3 end, float t)Point a fraction of the way from start to end.
private void IndicatePath(GrabAssistEventData data)Draws the dotted path from origin to target, coloured by whether a target was found.
private void IndicateTarget(GrabAssistEventData data)Draws the target marker facing the camera, scaled by distance, with a found or not found material.
private void OnEndGrabAssist()Empty.
private void OnStartGrabAssist()Resets the last path end point.
private void OnUpdateGrabAssist(GrabAssistEventData data)Draws the path and target for this frame.

Used in​

Members of other types that take, return or hold a GrabAssistView: