[This is preliminary documentation and is subject to change.]
Gets a trace start position and trace direction from the specified screen position.
Namespace: Rage
Assembly: RagePluginHook (in RagePluginHook.dll) Version: 0.0.0.0 (0.56.1131.11510)
Syntax
public static bool ConvertScreenPositionToTrace( Camera camera, Vector2 screenPosition, out Vector3 traceStartPosition, out Vector3 traceDirection )
Parameters
- camera
- Type: RageCamera
The camera currently being rendered. - screenPosition
- Type: RageVector2
The screen position. - traceStartPosition
- Type: RageVector3
The trace start position. - traceDirection
- Type: RageVector3
The direction to trace in.
Return Value
Type: BooleanA Boolean indicating whether the call was successful. Will only be false if the current camera could not be determined.
Examples
C#
Vector3? GetWorldPosition(Camera camera, Vector2 screenPosition) { Vector3 traceStart; Vector3 traceDirection; if (World.ConvertScreenPositionToTrace(camera, screenPosition, out traceStart, out traceDirection)) { Vector3 traceEnd = traceStart + traceDirection * 1000; HitResult hitResult = World.TraceLine(traceStart, traceEnd, TraceFlags.IntersectEverything); if (hitResult.Hit) { return hitResult.HitPosition; } } return null; }
See Also