I have some code where I take a global position, convert that with InverseTransformPoint to local. I then split that variable up into two variables, one subtracts from it and the other adds to it (the same value is subtracted/added). When this stage is done the difference between the two, locally, are (0.2,0.2,0.0). However, after converting it back to global the difference between the two are (-4.7,-0.8,-0.8).
I’m aware it’s probably just my math or thinking that is off, but I thought I’d ask nonetheless. Does it return wrong points? Or is there some weird voodoo ritual I gotta do first?
Here’s the code I use for converting and tweaking (info is a RaycastHit, radius is a Vector3):
Vector3 localUpperRightCorner = (transform.InverseTransformPoint(info.point)+radius);
Vector3 localLowerLeftCorner = (transform.InverseTransformPoint(info.point)-radius);
Vector3 upperRightCorner = transform.TransformPoint(localUpperRightCorner);
Vector3 lowerLeftCorner = transform.TransformPoint(localLowerLeftCorner);
localUpperRightCorner - localLowerLeftCorner = (0.2,0.2,0.0)
upperRightCorner - lowerLeftCorner = (-4.7,-0.8,-0.8)
X&Y on the latter is supposed to equal the previous one’s.
One of my comments earlier:
Yes, I use a different scale. What I need done is to just plot out a small distance from one corner of the object to the other. The distance totaled to (0.2,0.2,0). This distance was plotted out on the surface of another object (thus the raycasthit). then I took those coordinates and made them into global, and they don’t align themselves to what they should’ve. Which is the issue I’m facing.