@@ -97,20 +97,20 @@ static std::expected<void, std::string> update(/* clang-format off */
9797 auto & velocity = carView.get <components::Velocity>(entity);
9898 auto & angularVelocity = carView.get <components::AngularVelocity>(entity);
9999
100- const float maxCarSpeed = 15 .0f ; // Maximum speed in units per second
101- const float acceleration = 25 .0f ; // Acceleration rate
102- const float deceleration = 30 .0f ; // Deceleration rate when no input
100+ const float maxCarSpeed = 15 .0f ; // Maximum speed in units per second
101+ const float acceleration = 25 .0f ; // Acceleration rate
102+ const float deceleration = 30 .0f ; // Deceleration rate when no input
103103 const float brakeDeceleration = 40 .0f ; // Deceleration when braking
104- const float maxTurnSpeed = 2 .0f ; // Maximum radians per second
105- const float turnAcceleration = 8 .0f ; // How fast we accelerate into turns
106- const float turnDeceleration = 12 .0f ; // How fast we decelerate out of turns
104+ const float maxTurnSpeed = 2 .0f ; // Maximum radians per second
105+ const float turnAcceleration = 8 .0f ; // How fast we accelerate into turns
106+ const float turnDeceleration = 12 .0f ; // How fast we decelerate out of turns
107107
108108 float targetSpeed = 0 .0f ;
109109 float movementInput = 0 .0f ; // Track how much we're moving
110110 float targetAngularVelocity = 0 .0f ; // Target turning speed
111111
112112 glm::vec3 forward = rotation.value * glm::vec3 (0 .0f , 1 .0f , 0 .0f );
113-
113+
114114 // Get current speed in the forward direction
115115 float currentSpeed = glm::dot (velocity.value , -forward);
116116
@@ -120,13 +120,13 @@ static std::expected<void, std::string> update(/* clang-format off */
120120 movementInput = 1 .0f ; // Moving forward
121121 } else if (input::Keyboard::isBeingHeld (input::Key::S)) {
122122 targetSpeed = -maxCarSpeed * 0 .6f ; // Reverse is slower
123- movementInput = 1 .0f ; // Moving backward
123+ movementInput = 1 .0f ; // Moving backward
124124 }
125125
126126 // Smooth speed interpolation
127127 float speedDifference = targetSpeed - currentSpeed;
128128 float maxSpeedChange;
129-
129+
130130 if (movementInput > 0 .0f ) {
131131 // We have input - accelerate towards target
132132 if ((targetSpeed > 0 && currentSpeed < targetSpeed) || (targetSpeed < 0 && currentSpeed > targetSpeed)) {
@@ -139,14 +139,14 @@ static std::expected<void, std::string> update(/* clang-format off */
139139 // No input - natural deceleration
140140 maxSpeedChange = deceleration * time.deltaTime ;
141141 }
142-
142+
143143 // Apply speed change with limits
144144 if (std::abs (speedDifference) > maxSpeedChange) {
145145 currentSpeed += (speedDifference > 0 ) ? maxSpeedChange : -maxSpeedChange;
146146 } else {
147147 currentSpeed = targetSpeed;
148148 }
149-
149+
150150 // Convert speed back to velocity vector
151151 velocity.value = -forward * currentSpeed;
152152
@@ -198,7 +198,10 @@ static std::expected<void, std::string> update(/* clang-format off */
198198 return {};
199199}
200200
201- void scenes::NFS::build (Game& game) {
201+ void scenes::nfs::NFS::build (Game& game) {
202+ std::shared_ptr<scenes::nfs::components::CameraState> cameraState;
203+ game.addResource (cameraState);
204+
202205 game.addSystem (Schedule::Startup, startup);
203206 game.addSystem (Schedule::Update, update);
204207}
0 commit comments