mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-12 08:00:30 +01:00
* Mouse can now be used to fully navigate menus * Added check for driver's current vehicle when releasing from Stop waypoint in case the ped is not in a vehicle. * Lines are now only drawn between waypoint markers under the same conditions that waypoint markers are drawn * Updated marker position to be player's mouse position * Version update * Added logic to update waypoint position during driving task if the waypoint position was changed before the driver arrived. * Removed unused usings. Refactored debug statements to use Game.LogTrivial instead of Logger.Log * Removed class * Removed Logger class * Consolidated all custom enums to this class. Added default waypoint settings from .ini * Modified a hint message * Fixed collector options not being enabled/disabled when Collector box is checked * Refactored AITasking into CollectedVehicle. * Updated reference to vehicle tasking based on AITasking refactor. Fixed speed zone radius not updating correctly. * Version update * Refactored AITasking into CollectedVehicle * Added check for CollectorRadius being more than SpeedZoneRadius. Added debug messages when values are reset to default. * Added hint message if player tries to edit waypoints while 3D waypoints are disabled * Fixed a bug where a 3D waypoint marker would be drawn even if 3D waypoints were disabled * Removed unnecessary property setting when a vehicle is being removed from a path. * Added a check for if the driver loses their task and reassigns it. * Fixed a bug where the 3D line between waypoints was still being drawn even though 3D waypoints were disabled in the settings menu. * Updated version * Added console command to show info about collected vehicles. * Added ConsoleCommand class, removed AITasking class. * Removed class after refactoring into CollectedVehicle * Update README.md * Update README.md * Added ini setting for Advanced Barrier Options. Added enum for TrafficLight state. Added debug message for invalid barriers. * Updated version * Added MousePositionInWorld and RNUIMouseInputHandler classes * Fixed a crash when a collected ped is arrested. * Refactored to implement RNUIMouseInputHandler class. * Removed unused method. * Updated version * Disabled deletion/creation of shadow barrier and re-enabled updating position based on mouse position. * Added check for Driver's current vehicle in driving loop in case the Driver exited Vehicle at some point. Adjusted some guard clause logic and log messages. * Removed unused variable * Renamed some methods to improve clarity * Updated version.
42 lines
1.9 KiB
C#
42 lines
1.9 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|