Merge pull request #44 from xen-42/debug-raycast

Fixed Reloading and Debug Raycast
This commit is contained in:
Nick 2022-02-25 20:18:19 -05:00 committed by GitHub
commit b6e71c0792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -141,6 +141,11 @@ namespace NewHorizons
{ {
BodyDict["SolarSystem"] = new List<NewHorizonsBody>(); BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this); SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this);
foreach (AssetBundle bundle in AssetBundles.Values)
{
bundle.Unload(true);
}
AssetBundles.Clear();
Logger.Log("Begin reload of config files...", Logger.LogType.Log); Logger.Log("Begin reload of config files...", Logger.LogType.Log);

View File

@ -1,4 +1,5 @@
using NewHorizons.Builder.Body; using NewHorizons;
using NewHorizons.Builder.Body;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -21,7 +22,7 @@ namespace NewHorizons.Utility
private void Update() private void Update()
{ {
if (Keyboard.current != null && Keyboard.current[Key.P].wasReleasedThisFrame) if (Main.Debug && Keyboard.current != null && Keyboard.current[Key.P].wasReleasedThisFrame)
{ {
// Raycast // Raycast
_rb.DisableCollisionDetection(); _rb.DisableCollisionDetection();
@ -31,7 +32,8 @@ namespace NewHorizons.Utility
if (Physics.Raycast(origin, direction, out RaycastHit hitInfo, 100f, layerMask)) if (Physics.Raycast(origin, direction, out RaycastHit hitInfo, 100f, layerMask))
{ {
var pos = hitInfo.transform.InverseTransformPoint(hitInfo.point); var pos = hitInfo.transform.InverseTransformPoint(hitInfo.point);
Logger.Log($"Raycast hit {{\"x\": {pos.x}, \"y\": {pos.y}, \"z\": {pos.z}}} on [{hitInfo.transform.gameObject.name}]"); var o = hitInfo.transform.gameObject;
Logger.Log($"Raycast hit {{\"x\": {pos.x}, \"y\": {pos.y}, \"z\": {pos.z}}} on [{o.name}] at [{SearchUtilities.GetPath(o.transform)}]");
} }
_rb.EnableCollisionDetection(); _rb.EnableCollisionDetection();
} }