Example #1
0
        private void Physicalize()
        {
            // Physicalize the player as type Living.
            // This physical entity type is specifically implemented for players
            var parameters = new LivingPhysicalizeParams();

            //The player will have settings for the player dimensions and dynamics.
            var playerDimensions = parameters.PlayerDimensions;
            var playerDynamics   = parameters.PlayerDynamics;

            parameters.Mass = Mass;

            // Prefer usage of a capsule instead of a cylinder
            playerDimensions.UseCapsule = true;

            // Specify the size of our capsule
            playerDimensions.ColliderSize = new Vector3(0.45f, 0.45f, EyeHeight * 0.25f);

            // Keep pivot at the player's feet (defined in player geometry)
            playerDimensions.PivotHeight = 0.0f;

            // Offset collider upwards
            playerDimensions.ColliderHeight       = 1.0f;
            playerDimensions.GroundContactEpsilon = 0.004f;

            playerDynamics.AirControlCoefficient = 0.0f;
            playerDynamics.AirResistance         = AirResistance;
            playerDynamics.Mass = Mass;

            Entity.Physics.Physicalize(parameters);
        }
Example #2
0
        private void PhysicalizeEntity()
        {
            var physicsEntity = Entity.Physics;

            if (physicsEntity == null)
            {
                return;
            }

            var parameters       = new LivingPhysicalizeParams();
            var playerDimensions = parameters.PlayerDimensions;

            parameters.Mass = 90f;
            playerDimensions.PivotHeight = 1f;
            Entity.Physics.Physicalize(parameters);
        }