Exemple #1
0
        /// <summary>
        ///   Remove any existing collision shapes for this
        ///   DisplayObject, and recreate them with the correct
        ///   position, orientation and scale.
        /// </summary>
        public void RecreateCollisionShapes()
        {
            List <CollisionShape> shapes = WorldEditor.Instance.FindMeshCollisionShapes(this.meshName, this.entity);

            if (shapes.Count == 0)
            {
                return;
            }
            collisionManager.RemoveCollisionShapesWithHandle(oid);
            foreach (CollisionShape originalShape in shapes)
            {
                CollisionShape shape = originalShape.Clone();
                shape.Transform(node.DerivedScale,
                                node.DerivedOrientation,
                                node.DerivedPosition);
                collisionManager.AddCollisionShape(shape, oid);
            }
        }
Exemple #2
0
        /// <summary>
        ///   Look up the collision shapes associated with the mesh
        ///   name, transform them and add them to the sphere tree
        /// </summary>
        public void AddCollisionObject()
        {
            if (collisionManager == null)
            {
                LogManager.Instance.Write("DisplayObject.collisionManager is null!");
                return;
            }
            List <CollisionShape> shapes = WorldEditor.Instance.FindMeshCollisionShapes(this.meshName, this.entity);

            if (shapes.Count == 0)
            {
                return;
            }
            foreach (CollisionShape untransformedShape in shapes)
            {
                CollisionShape shape = untransformedShape.Clone();
                shape.Transform(node.DerivedScale,
                                node.DerivedOrientation,
                                node.DerivedPosition);
                collisionManager.AddCollisionShape(shape, oid);
            }
        }