diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-04 15:47:22 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-04 15:47:22 +0000 |
commit | c32674d9bac2cf6283cafc3bf446a45be22b2851 (patch) | |
tree | b28ea4d923fa945aba3f91d636394f74429d2ae1 /game/vehicles | |
parent | RailVehicleClass now renders bogie shadows as well as body (diff) | |
download | ilt-c32674d9bac2cf6283cafc3bf446a45be22b2851.tar.bz2 ilt-c32674d9bac2cf6283cafc3bf446a45be22b2851.tar.xz ilt-c32674d9bac2cf6283cafc3bf446a45be22b2851.zip |
Default RailVehicle bogie positions according to class wheelBase
Useful for render tests so everything looks sane
Diffstat (limited to 'game/vehicles')
-rw-r--r-- | game/vehicles/railVehicle.cpp | 6 | ||||
-rw-r--r-- | game/vehicles/railVehicle.h | 2 |
2 files changed, 7 insertions, 1 deletions
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 <memory> #include <ray.hpp> +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); |