From e3b587143dfc4e8b97d8916ef1d4bcd1dd43734c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 6 Jan 2024 12:06:26 +0000 Subject: Simplified RailVehicle::intersectRay --- game/vehicles/railVehicle.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'game/vehicles') diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp index 6653333..94f72e4 100644 --- a/game/vehicles/railVehicle.cpp +++ b/game/vehicles/railVehicle.cpp @@ -49,16 +49,16 @@ RailVehicle::intersectRay(const Ray & ray, BaryPosition & baryPos, RelativeDista constexpr const auto X = 1350.F; const auto Y = this->rvClass->length / 2.F; constexpr const auto Z = 3900.F; - const auto moveBy = location.getRotationTransform(); + const glm::mat3 moveBy = location.getRotationTransform(); const std::array cornerVertices {{ - location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, Y, 0, 1}).xyz(), // LFB - location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, Y, 0, 1}).xyz(), // RFB - location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, Y, Z, 1}).xyz(), // LFT - location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, Y, Z, 1}).xyz(), // RFT - location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, -Y, 0, 1}).xyz(), // LBB - location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, -Y, 0, 1}).xyz(), // RBB - location.position() + GlobalPosition3D(moveBy * glm::vec4 {-X, -Y, Z, 1}).xyz(), // LBT - location.position() + GlobalPosition3D(moveBy * glm::vec4 {X, -Y, Z, 1}).xyz(), // RBT + location.position() + GlobalPosition3D(moveBy * glm::vec3 {-X, Y, 0}), // LFB + location.position() + GlobalPosition3D(moveBy * glm::vec3 {X, Y, 0}), // RFB + location.position() + GlobalPosition3D(moveBy * glm::vec3 {-X, Y, Z}), // LFT + location.position() + GlobalPosition3D(moveBy * glm::vec3 {X, Y, Z}), // RFT + location.position() + GlobalPosition3D(moveBy * glm::vec3 {-X, -Y, 0}), // LBB + location.position() + GlobalPosition3D(moveBy * glm::vec3 {X, -Y, 0}), // RBB + location.position() + GlobalPosition3D(moveBy * glm::vec3 {-X, -Y, Z}), // LBT + location.position() + GlobalPosition3D(moveBy * glm::vec3 {X, -Y, Z}), // RBT }}; static constexpr const std::array, 10> triangles {{ // Front -- cgit v1.2.3