Exemple #1
0
        /// <summary>
        /// Adds the character to the engine processing pipeline.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <exception cref="System.Exception">Cannot perform this action when the physics engine is set to CollisionsOnly</exception>
        public void AddCharacter(Character character)
        {
            if (discreteDynamicsWorld == null)
            {
                throw new Exception("Cannot perform this action when the physics engine is set to CollisionsOnly");
            }

            var collider = character.InternalCollider;
            var action   = character.KinematicCharacter;

            discreteDynamicsWorld.AddCollisionObject(collider, BulletSharp.CollisionFilterGroups.CharacterFilter);
            discreteDynamicsWorld.AddCharacter(action);
        }
Exemple #2
0
        internal void AddCharacter(CharacterComponent character, CollisionFilterGroupFlags group, CollisionFilterGroupFlags mask)
        {
            if (discreteDynamicsWorld == null)
            {
                throw new Exception("Cannot perform this action when the physics engine is set to CollisionsOnly");
            }

            var collider = character.NativeCollisionObject;
            var action   = character.KinematicCharacter;

            discreteDynamicsWorld.AddCollisionObject(collider, (BulletSharp.CollisionFilterGroups)group, (BulletSharp.CollisionFilterGroups)mask);
            discreteDynamicsWorld.AddCharacter(action);

            character.Simulation = this;
        }