I am trying to add the bounds of a collider that is added at runtime. For some reason, I am unable to see updates to center or size or extent when I set it using the below:
var p = new GameObject("box"); p.AddComponent(BoxCollider); p.collider.bounds.center = Vector3(4.5,4.5,4.5); . . .
The resulting collider shows up in the inspector, but the values are always default, i.e., center and size aren't showing up as defined.
How do you set the bounds, center, and such of a collider added at runtime?
asked Mar 13 '12 at 03:46 AM
I don't think you can assign the bounds of a collider directly. However, the collider itself has center and extents properties that you can assign. As an example: