Consistent World Transformation of Collider Point

I’m trying to get accurate world coordinates for a certain local point of an object’s box collider (say, the bottom rear right corner when facing +z). I’ve used the following implementation in a script attached to the object:

var pos:Vector3=transform.TransformPoint(

This places it pretty close to where I’d expect, when the object is facing forward; however, when I turn it to the side in the game (rotate it left by the Y axis), the point that this returns bows outward, a good 20% or so outside the collider, making the particles I’m spewing from it leave widening and narrowing trails. Do you know what’s going on, and how to keep it more consistently accurate no matter the transform’s orientation?

You’re right: bounds is a AABB - Axis Aligned Bounding Box - so it doesn’t rotate with the object, as you’ve already found. A simple way to avoid this problem is to get these dimensions at Start: make sure the object has zero initial rotation and save the extents in some variable.

private var ext: Vector3;

function Start(){
    var rot = transform.rotation; // zero the rotation, if needed
    transform.rotation = Quaternion.identity;
    ext = collider.bounds.extents; // save the extents
    transform.rotation = rot; // restore the rotation

  // you can calculate the points you need in a simpler way:
    var rearPoint = transform.TransformPoint(0, -ext.y, -ext.z);
    var bottomPoint = transform.TransformPoint(0, -ext.y, 0);
    var frontPoint = transform.TransformPoint(0, 0, ext.z);