Reverting to the previous World-Raycast method as it gave more accurate/expected results
This commit is contained in:
sinaioutlander 2020-12-12 23:24:44 +11:00
parent 27f6a6ca52
commit 6dfa4806ce
2 changed files with 5 additions and 14 deletions

View File

@ -16,7 +16,7 @@ namespace UnityExplorer
public class ExplorerCore
{
public const string NAME = "UnityExplorer";
public const string VERSION = "3.0.6";
public const string VERSION = "3.0.8";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.unityexplorer";
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer";

View File

@ -109,21 +109,12 @@ namespace UnityExplorer.Inspectors
internal static void RaycastWorld(Vector2 mousePos)
{
var ray = UnityHelpers.MainCamera.ScreenPointToRay(mousePos);
var casts = Physics.RaycastAll(ray, 1000f);
Physics.Raycast(ray, out RaycastHit hit, 1000f);
if (casts.Length > 0)
if (hit.transform)
{
foreach (var cast in casts)
{
if (cast.transform)
{
var obj = cast.transform.gameObject;
OnHitGameObject(obj);
break;
}
}
var obj = hit.transform.gameObject;
OnHitGameObject(obj);
}
else
{