diff --git a/src/items/item.cpp b/src/items/item.cpp index 8f3eb7d07..2586e2d71 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -43,7 +43,7 @@ Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal, m_distance_2 = 1.2f; initItem(type, xyz); - m_original_rotation = Track::createRotationFromNormal(normal); + m_original_rotation = shortestArcQuat(Vec3(0, 1, 0), normal); m_rotation_angle = 0.0f; m_original_mesh = mesh; m_original_lowmesh = lowres_mesh; diff --git a/src/modes/three_strikes_battle.cpp b/src/modes/three_strikes_battle.cpp index e714abf66..d7bd54111 100644 --- a/src/modes/three_strikes_battle.cpp +++ b/src/modes/three_strikes_battle.cpp @@ -711,7 +711,7 @@ void ThreeStrikesBattle::loadCustomModels() const ArenaNode* n = ag->getNode(node); btTransform t; t.setOrigin(n->getCenter()); - t.setRotation(Track::createRotationFromNormal(n->getNormal())); + t.setRotation(shortestArcQuat(Vec3(0, 1, 0), n->getNormal())); pos.push_back(t); pos_created++; used.push_back(node); diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 9fbb61f96..56be84804 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -692,7 +692,7 @@ btQuaternion Track::getArenaStartRotation(const Vec3& xyz, float heading) } const Vec3& normal = Graph::get()->getQuad(node)->getNormal(); - btQuaternion q = createRotationFromNormal(normal); + btQuaternion q = shortestArcQuat(Vec3(0, 1, 0), normal); btMatrix3x3 m; m.setRotation(q); return btQuaternion(m.getColumn(1), heading * DEGREE_TO_RAD) * q; diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index b0f640648..ddc04e691 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -392,14 +392,6 @@ public: static const float NOHIT; - static btQuaternion createRotationFromNormal(const Vec3& normal) - { - Vec3 axis = -normal.cross(Vec3(0, 1, 0)); - if (axis.length() == 0) - axis = Vec3(0, 0, 1); - return btQuaternion(axis, normal.angle(Vec3(0, 1, 0))); - } // createRotationFromNormal - Track (const std::string &filename); ~Track (); void cleanup ();