public void OnTriggerStay(Collider other) { Rigidbody otherBody = other.GetComponent <Rigidbody>(); if (otherBody == null || !submergedObjs.ContainsKey(otherBody)) { return; } for (int i = 0; i < submergedObjs.Count; i++) { submergedObjs[otherBody].voxels = VoxelizedObject.MakeVoxel(other, voxelSize); } }
public void OnTriggerEnter(Collider other) { Rigidbody otherBody = other.GetComponent <Rigidbody>(); if (otherBody == null) { return; } if (!submergedObjs.ContainsKey(otherBody)) { SubMergedObject subObject = new SubMergedObject(); subObject.voxels = VoxelizedObject.MakeVoxel(other, voxelSize); subObject.drag = otherBody.drag; subObject.angDrag = otherBody.angularDrag; submergedObjs.Add(otherBody, subObject); } }