From c32674d9bac2cf6283cafc3bf446a45be22b2851 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 4 Mar 2023 15:47:22 +0000 Subject: Default RailVehicle bogie positions according to class wheelBase Useful for render tests so everything looks sane --- game/vehicles/railVehicle.cpp | 6 ++++++ game/vehicles/railVehicle.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp index cbe36a6..77907be 100644 --- a/game/vehicles/railVehicle.cpp +++ b/game/vehicles/railVehicle.cpp @@ -11,6 +11,12 @@ #include #include +RailVehicle::RailVehicle(RailVehicleClassPtr rvc) : rvClass {std::move(rvc)} +{ + bogies.front().pos.y = rvClass->wheelBase / 2.F; + bogies.back().pos.y = -bogies.front().pos.y; +} + void RailVehicle::render(const SceneShader & shader) const { diff --git a/game/vehicles/railVehicle.h b/game/vehicles/railVehicle.h index f172a28..bbf4df9 100644 --- a/game/vehicles/railVehicle.h +++ b/game/vehicles/railVehicle.h @@ -16,7 +16,7 @@ class Ray; class Train; class RailVehicle : public Renderable, Selectable { public: - explicit RailVehicle(RailVehicleClassPtr rvc) : rvClass {std::move(rvc)} { } + explicit RailVehicle(RailVehicleClassPtr rvc); void move(const Train *, float & trailBy); -- cgit v1.2.3