Skip to content

Commit

Permalink
[Car] Added on screen text which tells the players what the controls are
Browse files Browse the repository at this point in the history
  • Loading branch information
PanosK92 committed Dec 18, 2023
1 parent d3541b3 commit e307f00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 10 additions & 10 deletions runtime/Physics/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ namespace Spartan
// 2. all the values are based on the toyota ae86 sprinter trueno, when literature was not available, values were approximated based on a typical mid-size car

// engine
constexpr float engine_torque_max = 147.1f; // maximum torque output of the engine
constexpr float engine_max_rpm = 7600.0f; // maximum engine rpm - redline
constexpr float engine_idle_rpm = 900.0f; // idle engine rpm
vector<pair<float, float>> engine_torque_map =
constexpr float engine_torque_max = 147.1f; // maximum torque output of the engine
constexpr float engine_max_rpm = 7600.0f; // maximum engine rpm - redline
constexpr float engine_idle_rpm = 900.0f; // idle engine rpm
vector<pair<float, float>> engine_torque_map =
{
{ 1000.0f, 20.0f },
{ 2000.0f, 40.0f },
Expand Down Expand Up @@ -128,11 +128,11 @@ namespace Spartan
string wheel_name;
switch (wheel_index)
{
case tuning::wheel_fl: wheel_name = "FL"; break;
case tuning::wheel_fr: wheel_name = "FR"; break;
case tuning::wheel_rl: wheel_name = "RL"; break;
case tuning::wheel_rr: wheel_name = "RR"; break;
default: wheel_name = "Unknown"; break;
case tuning::wheel_fl: wheel_name = "FL"; break;
case tuning::wheel_fr: wheel_name = "FR"; break;
case tuning::wheel_rl: wheel_name = "RL"; break;
case tuning::wheel_rr: wheel_name = "RR"; break;
default: wheel_name = "Unknown"; break;
}

// setup ostringstream
Expand All @@ -148,7 +148,6 @@ namespace Spartan
oss << "Slip ratio: " << parameters.pacejka_slip_ratio[wheel_index] << " ( Fz: " << parameters.pacejka_fz[wheel_index] << " N ) \n";
oss << "Slip angle: " << parameters.pacejka_slip_angle[wheel_index] * Math::Helper::RAD_TO_DEG << " ( Fx: " << parameters.pacejka_fx[wheel_index] << " N ) \n";


return oss.str();
}

Expand All @@ -158,6 +157,7 @@ namespace Spartan
Renderer::DrawString(wheel_to_string(parameters, tuning::wheel_fr), Vector2(1.0f, 0.005f));
Renderer::DrawString(wheel_to_string(parameters, tuning::wheel_rl), Vector2(1.4f, 0.005f));
Renderer::DrawString(wheel_to_string(parameters, tuning::wheel_rr), Vector2(1.8f, 0.005f));
Renderer::DrawString("Take control! Use the arrow keys to steer the car and space for handbreak.", Vector2(0.005f, -0.96f));
}

void draw_info_general(CarParameters& parameters, const float speed)
Expand Down
2 changes: 0 additions & 2 deletions runtime/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,6 @@ namespace Spartan
World::RemoveEntity(entity_car->GetDescendantByName("RR_Wheel_Brake Disc_0"));
World::RemoveEntity(entity_car->GetDescendantByName("RR_Wheel_TireMaterial_0"));
World::RemoveEntity(entity_car->GetDescendantByName("RR_Caliper_BrakeCaliper_0"));

SP_LOG_INFO("Take control: Use the arrow keys to steer the car and space for handbreak!");
}

Engine::AddFlag(EngineMode::Game);
Expand Down

0 comments on commit e307f00

Please sign in to comment.