public MovingPart(CollisionAPI api, CollisionShape shape) { this.shape = shape; this.api = api; constantShape = shape; id = api.SphereTree.GetId(); renderedNodes = null; RenderedNode.MaybeCreateRenderedNodes(false, shape, id, ref renderedNodes); sphere = null; }
public void Transform(Vector3 scale, Quaternion rotate, Vector3 translate) { // TODO: This is a temporary solution, and terribly inefficient. // I need to update the transforms on the node properly, without // the remove/add. RenderedNode.RemoveNodeRendering(id, ref renderedNodes); shape = constantShape.Clone(); shape.Transform(scale, rotate, translate); id = api.SphereTree.GetId(); renderedNodes = null; RenderedNode.MaybeCreateRenderedNodes(false, shape, id, ref renderedNodes); sphere = null; }
// Create a SphereTreeNode leaf node public SphereTreeNode(CollisionShape shape, SphereTree sphereTree) : base(shape.center, shape.radius) { this.sphereTree = sphereTree; this.containedShape = shape; parent = null; children = new SphereTreeNode[childCount]; intersectingShapes = new List <CollisionShape>(); leafNode = true; sphereTree.idCounter++; id = sphereTree.idCounter; sphereTree.nodeCount++; RenderedNode.MaybeCreateRenderedNodes(true, shape, id, ref renderedNodes); }