public void Update() { Vector2 v = host.GetVelocity(); Vector2 pos = host.GetPosition(); var tempSteering = Steering; VectorHandler.Truncate(ref tempSteering, m_ForceSteer_Max); Steering = tempSteering; Steering *= 1 / host.GetMass(); v = v + Steering; VectorHandler.Truncate(ref v, host.GetMaxVelocity()); host.SetVelocity(v); host.SetPosition(pos + v); }
private void CreateNewVectorHandler() { this.vh = new VectorHandler(2f, MainWindow.MainW.ActualWidth, MainWindow.MainW.ActualHeight, this.GM.MapWidth, this.GM.MapHeight, this.GM.TileSize); }