I’ve been at this for several days and I’m having brain cramp.
I’m trying to determine the coordinates of a transform’s corners.
Say a square or rectangle - I’m only concerned with x and z positions.
So given a square transform with a transform.eulerAngles.y rotation, what would be the proper math to determine the positions of the four corners.
Or is there a Unity function or combo of functions that can determine this?
I’ve been trying to use transform.collider.bounds.extents and Mathf.Sin(transform.eulerAngles.y*Mathf.Deg2Rad)) as well as cosine functions, transform.localScale and all sorts of ideas but I’m going nuts trying to get this. I have several trig books in front of me, but I’m having a brain melt with the math.
also don’t forget you can use bounds instead of collider if you object doesn’t have a collider, or the collider is smaller then the mesh for what ever reason.
Granted a bit more complex… but worth knowing about.