Hey,
Trying to find where the far left/right extents of a static mesh are. Get Local Bounds sounds like it would do it, but either I’m not sure how to use the result or it’s not what I’m looking for.
Example: I need the two red dot locations here:
Hey,
Trying to find where the far left/right extents of a static mesh are. Get Local Bounds sounds like it would do it, but either I’m not sure how to use the result or it’s not what I’m looking for.
Example: I need the two red dot locations here:
Yeah, Get Local Bounds should do. It takes the pivot as 0 and gives the location of the each side of the bound relative to it, so in your case adding Min and Max values of the Y axis will give you that distance between each points.
Ah, I understand how it works now - thanks.
Also a note for anyone else who reads this, you have to multiply the vectors from Get Local Bounds by the scale of the object to get the world space bounds.
Hrm, I have an issue with this.
If my object is at 0, 0, 0. And it’s scale is 9, 9, 9. And it is a cube of 1cm:
Get Local Bounds min will return -0.5, -0.5, 0
Get Local Bounds max will return 0.5, 0.5, 1
Then if we multiply the min/max by the scale of 9 then we get:
Min: -4.5, -4.5, 0
Max: 4.5, 4.5, 9
And that is fine, by multiplying by the scale we compensate for the fact it is performed in local space.
Except… Then I rotate by 45 degrees on Z.
How do I get the correct location of the bounds now? They’re placed as if the object is not rotated.
Nevermind, I have solved it.
Rotate Vector Around Axis on the Min/Max fixes it.