public SpringCamera(Vehicle targetVehicle, Vector3 desiredPositionOffset, Vector3 lookAtOffset) : base(targetVehicle.RaceGame) { TargetVehicle = targetVehicle; DesiredPositionOffset = desiredPositionOffset; LookAtOffset = lookAtOffset; }
public ChasingCamera(Vehicle targetVehicle) : base(targetVehicle.RaceGame) { TargetVehicle = targetVehicle; Vector3 backward = TargetVehicle.GetWorld().Backward; backward.Normalize(); Vector3 up = TargetVehicle.GetWorld().Up; up.Normalize(); Position = TargetVehicle.Position + Vector3.Multiply(backward, DISTANCE); Position += Vector3.Multiply(up, HEIGHT); Target = TargetVehicle.Position; Target += Vector3.Multiply(up, HEIGHT); CreateViewpoint(Position, Target, Vector3.Up); CreateProjection(); }
protected override void Initialize() { FontMgr = new ResourceManager<SpriteFont>(this); TextureMgr = new ResourceManager<Texture2D>(this); ModelMgr = new ResourceManager<Model>(this); MusicMgr = new ResourceManager<Song>(this); SfxMgr = new ResourceManager<SoundEffect>(this); LoadAssets(); PressStartScreen = TextureMgr.Find("startscreen"); PressStartRectangle = new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height); Texture2D pauseTex = TextureMgr.Find("pause"); PausedRectangle = new Rectangle((Window.ClientBounds.Width - pauseTex.Width) / 2, (Window.ClientBounds.Height - pauseTex.Height) / 2, pauseTex.Width, pauseTex.Height); MediaPlayer.Play(MusicMgr.Find("RenditionIntro")); FpsHandler = new FpsCounter(this, FPS_INTERVAL); InputMgr = new InputManager(this); ModelDisplayer = new ModelDisplay(this); HeadsUpDisplay = new HUD(this); Car = new Vehicle(this, "L200-FBX", new Vector3(80, 80, -80), 0.01f, new Vector3(0, MathHelper.Pi, 0)); Ground = new Terrain(this, new Vector3(0, 0, 0), "colormap", "heightmap", 7.0f, 0.15f); GameTrack = new Track(this, Ground); GameCamera = Car.Camera; //GameCamera = new FreeCamera(this, new Vector3(0, 0, 2), Vector3.Zero, Vector3.Zero); Components.Add(FpsHandler); Components.Add(InputMgr); Components.Add(ModelDisplayer); Components.Add(GameTrack); Components.Add(Car); //Mettre GameCamera apres Car pour eviter les problemes Components.Add(GameCamera); //Laisser FpsDisplayer a la fin de la liste pour eviter les problemes d'affichage Components.Add(HeadsUpDisplay); base.Initialize(); Car.Enabled = false; HeadsUpDisplay.ToggleChronometer(); }