示例#1
0
 protected void UpdateConvexShapeInfo(ConvexShapeDescription description)
 {
     UpdateEntityShapeVolume(description.EntityShapeVolume);
     MinimumRadius   = description.MinimumRadius;
     MaximumRadius   = description.MaximumRadius;
     collisionMargin = description.CollisionMargin;
 }
示例#2
0
        /// <summary>
        /// Constructs a minkowski sum shape from cached data.
        /// </summary>
        /// <param name="shapeEntries">Entries composing the minkowski sum.</param>
        /// <param name="localOffset">Local offset of the elements in the minkowski sum.</param>
        /// <param name="description">Cached information about the shape. Assumed to be correct; no extra processing or validation is performed.</param>
        public MinkowskiSumShape(IList <OrientedConvexShapeEntry> shapeEntries, Vector3 localOffset,
                                 ConvexShapeDescription description)
        {
            for (int i = 0; i < shapeEntries.Count; i++)
            {
                Shapes.Add(shapeEntries[i]);
            }

            this.localOffset = localOffset;
            UpdateConvexShapeInfo(description);
            Shapes.Changed += ShapesChanged;
        }
示例#3
0
        /// <summary>
        /// Creates a ConvexHullShape from cached information. Assumes all data provided is accurate- no pre-processing is performed.
        /// </summary>
        /// <param name="localSurfaceVertices">List of vertex positions on the surface of the convex hull shape, centered on the desired origin. These vertices are used as-is for the shape representation; no additional processing occurs.</param>
        /// <param name="description">Cached information about the shape. Assumed to be correct; no extra processing or validation is performed.</param>
        public ConvexHullShape(IList <Vector3> localSurfaceVertices, ConvexShapeDescription description)
        {
            if (localSurfaceVertices.Count == 0)
            {
                throw new ArgumentException("Vertices list used to create a ConvexHullShape cannot be empty.");
            }

            unexpandedMaximumRadius = description.MaximumRadius - collisionMargin;
            unexpandedMinimumRadius = description.MinimumRadius - collisionMargin;
            vertices = new Vector3[localSurfaceVertices.Count];
            localSurfaceVertices.CopyTo(vertices, 0);
            UpdateConvexShapeInfo(description);
        }
示例#4
0
        ///<summary>
        /// Constructs a wrapped shape from cached data.
        ///</summary>
        ///<param name="shapeEntries">Already centered shape entries used to construct the shape.</param>
        /// <param name="description">Cached information about the shape. Assumed to be correct; no extra processing or validation is performed.</param>
        ///<exception cref="Exception">Thrown when the shape list is empty.</exception>
        public WrappedShape(IList <ConvexShapeEntry> shapeEntries, ConvexShapeDescription description)
        {
            if (shapeEntries.Count == 0)
            {
                throw new ArgumentException("Cannot create a wrapped shape with no contained shapes.");
            }

            for (int i = 0; i < shapeEntries.Count; i++)
            {
                Shapes.Add(shapeEntries[i]);
            }

            UpdateConvexShapeInfo(description);
            Shapes.Changed += ShapesChanged;
        }