예제 #1
0
        /// <summary>
        /// Removes the collider from the engine processing pipeline.
        /// </summary>
        /// <param name="collider">The collider.</param>
        public void RemoveCollider(Collider collider)
        {
            collisionWorld.RemoveCollisionObject(collider.InternalCollider);

            collider.Simulation = null;
        }
예제 #2
0
        /// <summary>
        /// Creates the collider.
        /// </summary>
        /// <param name="shape">The shape.</param>
        /// <returns></returns>
        public Collider CreateCollider(ColliderShape shape)
        {
            var collider = new Collider(shape)
            {
                InternalCollider = new BulletSharp.CollisionObject
                {
                    CollisionShape = shape.InternalShape,
                    ContactProcessingThreshold = !canCcd ? 1e18f : 1e30f
                }
            };

            collider.InternalCollider.UserObject = collider;

            collider.InternalCollider.CollisionFlags |= BulletSharp.CollisionFlags.NoContactResponse;

            if (shape.NeedsCustomCollisionCallback)
            {
                collider.InternalCollider.CollisionFlags |= BulletSharp.CollisionFlags.CustomMaterialCallback;
            }

            return collider;
        }
예제 #3
0
        /// <summary>
        /// Adds the collider to the engine processing pipeline.
        /// </summary>
        /// <param name="collider">The collider.</param>
        /// <param name="group">The group.</param>
        /// <param name="mask">The mask.</param>
        public void AddCollider(Collider collider, CollisionFilterGroupFlags group, CollisionFilterGroupFlags mask)
        {
            collisionWorld.AddCollisionObject(collider.InternalCollider, (BulletSharp.CollisionFilterGroups)group, (BulletSharp.CollisionFilterGroups)mask);

            collider.Simulation = this;
        }
예제 #4
0
 /// <summary>
 /// Adds the collider to the engine processing pipeline.
 /// </summary>
 /// <param name="collider">The collider.</param>
 public void AddCollider(Collider collider)
 {
     collisionWorld.AddCollisionObject(collider.InternalCollider);
     collider.Simulation = this;
 }