mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add missing null check and fallback for DebugRaycaster.cs
This commit is contained in:
parent
979c09b1b5
commit
5088749539
@ -1,3 +1,4 @@
|
||||
using NewHorizons.Components.Orbital;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@ -40,6 +41,12 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
{
|
||||
DebugRaycastData data = Raycast();
|
||||
|
||||
if (!data.hit)
|
||||
{
|
||||
Logger.Log("Debug Raycast Didn't Hit Anything! (Try moving closer)");
|
||||
return;
|
||||
}
|
||||
|
||||
var posText = $"{{\"x\": {data.pos.x}, \"y\": {data.pos.y}, \"z\": {data.pos.z}}}";
|
||||
var normText = $"{{\"x\": {data.norm.x}, \"y\": {data.norm.y}, \"z\": {data.norm.z}}}";
|
||||
|
||||
@ -95,7 +102,7 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
data.bodyName = o.name;
|
||||
data.bodyPath = SearchUtilities.GetPath(o.transform);
|
||||
data.hitObject = o;
|
||||
data.hitBodyGameObject = hitAstroObject?.gameObject;
|
||||
data.hitBodyGameObject = hitAstroObject?.gameObject ?? o;
|
||||
data.plane = ConstructPlane(data);
|
||||
}
|
||||
_rb.EnableCollisionDetection();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user