use origin instead of transform.position

This commit is contained in:
JohnCorby 2022-11-09 13:09:49 -08:00
parent 6c7c02d71c
commit 642c179eaf

View File

@ -128,8 +128,8 @@ namespace NewHorizons.Utility.DebugUtilities
data.pos = hitInfo.rigidbody.transform.InverseTransformPoint(hitInfo.point); data.pos = hitInfo.rigidbody.transform.InverseTransformPoint(hitInfo.point);
data.norm = hitInfo.rigidbody.transform.InverseTransformDirection(hitInfo.normal); data.norm = hitInfo.rigidbody.transform.InverseTransformDirection(hitInfo.normal);
var toPlayer = Vector3.ProjectOnPlane((transform.position - hitInfo.point).normalized, hitInfo.normal); var toOrigin = Vector3.ProjectOnPlane((origin - hitInfo.point).normalized, hitInfo.normal);
var worldSpaceRot = Quaternion.LookRotation(toPlayer, hitInfo.normal); var worldSpaceRot = Quaternion.LookRotation(toOrigin, hitInfo.normal);
data.rot = hitInfo.rigidbody.transform.InverseTransformRotation(worldSpaceRot); data.rot = hitInfo.rigidbody.transform.InverseTransformRotation(worldSpaceRot);
data.colliderPath = hitInfo.collider.transform.GetPath(); data.colliderPath = hitInfo.collider.transform.GetPath();