geometry how to find ray local hit point?

I’m sorry but I just can’t figure out but I’ve made it long way, … how else to find local point with vector 3 instead of transform, …

		Transform parent = OuterProjectile.transform.parent;
		OuterProjectile.transform.position = HitPoint;
		OuterProjectile.transform.parent = transform;
		BodyVulnerability = OuterProjectile.transform.localPosition.x;
		OuterProjectile.transform.parent = parent;

this works exactly the way I want and all that is I’m searching for that:

BodyVulnerability = OuterProjectile.transform.localPosition.x;

information, …

is there any else way to figure it out except with parenting, …

sorry I’m really bad at geometry

EDIT: sorry did world position instead of local repairing the Q now, …

Hi!

Don’t worry, this stuff can be confusing. I’m presuming you want the result local to whatever GameObject you’re currently “in” - i.e. whatever holds transform. I think you should be able to do something like:

Vector3 local_point = transform.worldToLocalMatrix.MultiplyPoint3x4(  Hitpoint );

Hope that helps
J.