mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
Delete MousePositionInWorld.cs
This commit is contained in:
parent
d1ffe1c9ca
commit
32af656960
1 changed files with 0 additions and 42 deletions
|
|
@ -1,42 +0,0 @@
|
||||||
using Rage;
|
|
||||||
using RAGENativeUI.Elements;
|
|
||||||
|
|
||||||
namespace SceneManager
|
|
||||||
{
|
|
||||||
internal static class MousePositionInWorld
|
|
||||||
{
|
|
||||||
internal static Vector3 GetPosition { get { return GetMousePositionInWorld(); } }
|
|
||||||
internal static Vector3 GetPositionForBarrier { get { return GetMousePositionInWorld(Settings.BarrierPlacementDistance); } }
|
|
||||||
|
|
||||||
private static Vector3 GetMousePositionInWorld(float maxDistance = 100f)
|
|
||||||
{
|
|
||||||
HitResult TracePlayerView(float maxTraceDistance = 100f, TraceFlags flags = TraceFlags.IntersectWorld) => TracePlayerView2(out Vector3 v1, out Vector3 v2, maxTraceDistance, flags);
|
|
||||||
|
|
||||||
HitResult TracePlayerView2(out Vector3 start, out Vector3 end, float maxTraceDistance, TraceFlags flags)
|
|
||||||
{
|
|
||||||
Vector3 direction = GetPlayerLookingDirection(out start);
|
|
||||||
end = start + (maxTraceDistance * direction);
|
|
||||||
return World.TraceLine(start, end, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 GetPlayerLookingDirection(out Vector3 camPosition)
|
|
||||||
{
|
|
||||||
if (Camera.RenderingCamera)
|
|
||||||
{
|
|
||||||
camPosition = Camera.RenderingCamera.Position;
|
|
||||||
return Camera.RenderingCamera.Direction;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float pitch = Rage.Native.NativeFunction.Natives.GET_GAMEPLAY_CAM_RELATIVE_PITCH<float>();
|
|
||||||
float heading = Rage.Native.NativeFunction.Natives.GET_GAMEPLAY_CAM_RELATIVE_HEADING<float>();
|
|
||||||
|
|
||||||
camPosition = Rage.Native.NativeFunction.Natives.GET_GAMEPLAY_CAM_COORD<Vector3>();
|
|
||||||
return (Game.LocalPlayer.Character.Rotation + new Rotator(pitch, 0, heading)).ToVector().ToNormalized();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TracePlayerView(maxDistance, TraceFlags.IntersectWorld).HitPosition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue