From d1fc5cd8e195d2633b4f7fd2d6b5bb23be98033e Mon Sep 17 00:00:00 2001
From: Tazpn <tazpn@users.sourceforge.net>
Date: Tue, 26 Jun 2007 02:27:59 +0000
Subject: [PATCH] Use world coordinates instead of local coordinates with the
 bhk objects.  Also dont for get to scale the translate part.

---
 NifExport/Coll.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/NifExport/Coll.cpp b/NifExport/Coll.cpp
index 22b4a49..4195c15 100755
--- a/NifExport/Coll.cpp
+++ b/NifExport/Coll.cpp
@@ -540,7 +540,8 @@ bhkShapeRef Exporter::makebhkBoxShape(INode *node, Object *obj, Matrix3& tm)
 
 		box->SetMaterial(HavokMaterial(mtl));
 
-		Matrix3 tm = GetLocalTM(node);
+		Matrix3 tm = node->GetObjectTM(0);
+		//tm.SetTrans(tm.GetTrans() / Exporter::bhkScaleFactor);
 		if (tm.IsIdentity())
 		{
 			retval = StaticCast<bhkShape>(box);
@@ -576,7 +577,8 @@ bhkShapeRef	Exporter::makebhkSphereShape(INode *node, Object *obj, Matrix3& tm)
 		shape->SetRadius(radius);
 		shape->SetMaterial(HavokMaterial(mtl));
 
-		Matrix3 tm = GetLocalTM(node);
+		Matrix3 tm = node->GetObjectTM(0);
+		tm.SetTrans(tm.GetTrans() / Exporter::bhkScaleFactor);
 		if (tm.IsIdentity())
 		{
 			retval = StaticCast<bhkShape>(shape);
@@ -615,7 +617,7 @@ bhkShapeRef	Exporter::makebhkCapsuleShape(INode *node, Object *obj, Matrix3& tm)
 		shape->SetRadius2(radius2);
 		shape->SetMaterial(HavokMaterial(mtl));
 
-		Matrix3 tm = GetLocalTM(node);
+		Matrix3 tm = node->GetObjectTM(0);
 		Point3 center = tm.GetTrans();
 
 		Matrix3 rot = tm;
-- 
GitLab