I am trying to set some parameters in c# but must have some syntax wrong…any help would be great!!I
Look at my comments to see what I am trying to do…import large amounts of building fracture peices into unity , to set up a destructable low poly city…
I am trying to set
convex=true on MeshCollider
and the weight,drag, etc. on the Rigidbody
I have confirmed that I can create the the two components,
I just need to update those parameters.
// Add a mesh collider/rigid body to each fracture peice
void Apply(Transform transform)
{
if (transform.name.ToLower().Contains("fracture_chunk"))
{
transform.gameObject.AddComponent(typeof(MeshCollider));
//set values I need!
//transform.gameObject.GetComponent(typeof(MeshCollider));
//<MeshCollider>.convex=true;
transform.gameObject.AddComponent(typeof(Rigidbody));
//transform.gameObject.GetComponent(typeof(RigigBody));
//<RigidBody>.Mass=1.0;
//<RigidBody>.Drag=.5
//<RigidBody>.AngularDrag=.1
}
foreach (Transform child in transform)
Apply(child);
}
Thanks!!!