/// <summary> /// Add a named shape to a given region, will return a new ReshapeableRigidBodySection if this works correctly. /// The returned handles will be owned by this object, so there is no need to dispose them or clean them up (if this /// object is disposed). However, you can manually remove a section at any time by calling destroySection. /// </summary> public ReshapeableRigidBodySection createSection(String shapeName, Vector3 translation, Quaternion rotation, Vector3 scale) { BulletShapeRepository repository = BulletInterface.Instance.ShapeRepository; if (repository.containsValidCollection(shapeName)) { var section = new ReshapeableRigidBodySection(this, repository.getCollection(shapeName).CollisionShape.createClone(), translation, rotation); sections.Add(section); return(section); } return(null); }
/// <summary> /// Empty and destroy a section removing it from the collision shape. It will no longer /// be usable after calling this function. /// </summary> /// <param name="name">The name of the region to destroy.</param> public void destroySection(ReshapeableRigidBodySection section) { sections.Remove(section); section.Dispose(); }