Hi all,
I’ve searched the forums and Google for help regarding this issue, but I haven’t managed to find a solution yet.
In Unity, I have been generating gameObjects (almost) entirely from script (meshes, joints, and colliders included), and it all has been working fairly well, but I’ve ran into a problem when I attempt to use transform.localscale on my gameObject. All of it re-sizes as expected, but the gameObject will no longer collide with terrain or a plane. Instead, it now falls right through.
All objects generated via script are sub-components of the gameObject that my script is attached to (hence “almost” entirely generated form script). My gameObject has been defined with original specifications in centimeters, but since Unity’s default unit of measurement seems to be meters, my gameObject ends up being the size of a building. I am attempting to transform.localscale the entire object to remedy this situation.
None of the colliders are marked as trigger, all colliders are convex, and none of the colliders seem to be touching other objects when they spawn. Oddly enough, when I highlight my gameObject in Edit mode, all of the colliders are the correct size, and in the correct positions.
Based on what I have learned so far, I think that it might be an issue regarding the raycasts of the colliders not being updated when the colliders are resized (assuming my understanding of colliders is accurate). What do you guys think? Is there any way that I can “refresh” the physics of the colliders at runtime? Is there anything else I could to resize my gameObject and all of its children? I have tried changing their options and translating them in an attempt to force Unity to do so, but I have still had no luck. I should also note that I use mesh and wheel colliders at the moment.