Hello Unityrs, I have my model from on OBJ file. I attach it a MeshCollider and in my script I set
obj.GetComponent().convex = true;
I run the script and I can see in the inspector that convex is enabled. Now, my OBJ also have a rigid body with ‘useGravity’ = false.
In the inspector I enable the ‘useGravity’ and the object doesn’t interact with anything in the scene (Just a cube and a big plane).
BUT if in the inspector I disable and enable again the ‘convex’ and I enable ‘useGravity’ everything is ok… WHY???
This is my code:
obj.AddComponent(typeof(MeshFilter));
obj.AddComponent(typeof(MeshRenderer));
obj.AddComponent(typeof(MeshCollider));
obj.AddComponent(typeof(Rigidbody));
obj.GetComponent().useGravity = false;
obj.GetComponent().isKinematic = false;
obj.GetComponent().convex = true;