From 4f34ccd2e2fd20a1635ca1ac42932c514db56f6a Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sat, 5 Feb 2011 13:22:00 +0000 Subject: [PATCH] Added initial rotation of physical objects. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7628 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/physics/btKartRaycast.cpp | 1 + src/physics/physical_object.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/physics/btKartRaycast.cpp b/src/physics/btKartRaycast.cpp index 13107ddab..04f122a5d 100644 --- a/src/physics/btKartRaycast.cpp +++ b/src/physics/btKartRaycast.cpp @@ -79,6 +79,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to, result.m_hitNormalInWorld = tm.getInterpolatedNormal(rayCallback.getTriangleIndex(), result.m_hitPointInWorld); +#define DEBUG_NORMALS #ifdef DEBUG_NORMALS printf("old %f %f %f new %f %f %f\n", n.getX(), n.getY(), n.getZ(), diff --git a/src/physics/physical_object.cpp b/src/physics/physical_object.cpp index b4b5d265e..a88620555 100644 --- a/src/physics/physical_object.cpp +++ b/src/physics/physical_object.cpp @@ -59,6 +59,11 @@ PhysicalObject::PhysicalObject(const XMLNode &xml_node) else fprintf(stderr, "Unknown shape type : %s\n", shape.c_str()); m_init_pos.setIdentity(); + Vec3 hpr(m_init_hpr); + hpr.degreeToRad(); + btQuaternion q; + q.setEuler(hpr.getX(), hpr.getY(), hpr.getZ()); + m_init_pos.setRotation(q); Vec3 init_xyz(m_init_xyz); m_init_pos.setOrigin(init_xyz);