private void _playerCharacter_DisplacementModeChanged(object sender, Shared.Entities.Events.EntityDisplacementModeEventArgs e) { _entityRotations.SetDisplacementMode(e.CurrentDisplacement, _worldPosition + _entityEyeOffset); #if DEBUG logger.Info("{0} is now {1}", PlayerCharacter.CharacterName, e.CurrentDisplacement.ToString()); #endif if (e.CurrentDisplacement == EntityDisplacementModes.Walking || e.CurrentDisplacement == EntityDisplacementModes.Swiming) { _fallMaxHeight = double.MinValue; _physicSimu.StartSimulation(_worldPosition); _physicSimu.ConstraintOnlyMode = false; } else if (e.CurrentDisplacement == EntityDisplacementModes.Dead) { _physicSimu.StartSimulation(ref _worldPosition, ref _worldPosition); _physicSimu.ConstraintOnlyMode = true; } //Collision detection not activated oustide debug mode when flying ! #if !DEBUG else if (e.CurrentDisplacement == EntityDisplacementModes.Flying) { _physicSimu.StartSimulation(ref _worldPosition, ref _worldPosition); _physicSimu.ConstraintOnlyMode = true; } #endif else { _physicSimu.StopSimulation(); } }
public MoveAI(ServerNpc parentNpc) { _parentNpc = parentNpc; var size = parentNpc.DynamicEntity.DefaultSize; var bb = new BoundingBox(Vector3.Zero, size); size.Y = 0; bb = bb.Offset(-size / 2); VerletSimulator = new VerletSimulator(ref bb); VerletSimulator.ConstraintFct += Npc.Server.LandscapeManager.IsCollidingWithTerrain; VerletSimulator.StartSimulation(parentNpc.DynamicEntity.Position); FollowKeepDistance = 3; FollowStayDistance = 5; }