]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/bvh/BVHMotionTransform.cxx
Cleanup some nonprinting characters make this file work
[simgear.git] / simgear / scene / bvh / BVHMotionTransform.cxx
index 4188f329c583ca43f76568642c909b0f2083b0e6..f86668ed587e6dc6ae04c2aae846e6dc116bf7d8 100644 (file)
@@ -31,6 +31,7 @@ BVHMotionTransform::BVHMotionTransform() :
     _linearVelocity(0, 0, 0),
     _angularVelocity(0, 0, 0),
     _referenceTime(0),
+    _startTime(0),
     _endTime(0),
     _id(0)
 {
@@ -56,6 +57,7 @@ BVHMotionTransform::setTransform(const BVHMotionTransform& transform)
     _linearVelocity = transform._linearVelocity;
     _angularVelocity = transform._angularVelocity;
     _referenceTime = transform._referenceTime;
+    _startTime = transform._startTime;
     _endTime = transform._endTime;
     _id = transform._id;
     invalidateParentBound();
@@ -85,7 +87,8 @@ BVHMotionTransform::computeBoundingSphere() const
     SGSphered sphere(BVHGroup::computeBoundingSphere());
     if (sphere.empty())
         return sphere;
-    SGVec3d centerStart = _toWorldReference.xformPt(sphere.getCenter());
+    SGMatrixd toWorldStart = getToWorldTransform(_startTime);
+    SGVec3d centerStart = toWorldStart.xformPt(sphere.getCenter());
     SGMatrixd toWorldEnd = getToWorldTransform(_endTime);
     SGVec3d centerEnd = toWorldEnd.xformPt(sphere.getCenter());
     double rad = 0.5*length(centerStart - centerEnd) + sphere.getRadius();