Sfoglia il codice sorgente

Fixed bug where SegmentCast did not update closestT

Sanjay Madhav 5 anni fa
parent
commit
e74685cd22

+ 1 - 0
Chapter10/PhysWorld.cpp

@@ -33,6 +33,7 @@ bool PhysWorld::SegmentCast(const LineSegment& l, CollisionInfo& outColl)
 			// Is this closer than previous intersection?
 			if (t < closestT)
 			{
+				closestT = t;
 				outColl.mPoint = l.PointOnSegment(t);
 				outColl.mNormal = norm;
 				outColl.mBox = box;

+ 1 - 0
Chapter11/PhysWorld.cpp

@@ -33,6 +33,7 @@ bool PhysWorld::SegmentCast(const LineSegment& l, CollisionInfo& outColl)
 			// Is this closer than previous intersection?
 			if (t < closestT)
 			{
+				closestT = t;
 				outColl.mPoint = l.PointOnSegment(t);
 				outColl.mNormal = norm;
 				outColl.mBox = box;

+ 1 - 0
Chapter12/PhysWorld.cpp

@@ -33,6 +33,7 @@ bool PhysWorld::SegmentCast(const LineSegment& l, CollisionInfo& outColl)
 			// Is this closer than previous intersection?
 			if (t < closestT)
 			{
+				closestT = t;
 				outColl.mPoint = l.PointOnSegment(t);
 				outColl.mNormal = norm;
 				outColl.mBox = box;

+ 1 - 0
Chapter13/PhysWorld.cpp

@@ -33,6 +33,7 @@ bool PhysWorld::SegmentCast(const LineSegment& l, CollisionInfo& outColl)
 			// Is this closer than previous intersection?
 			if (t < closestT)
 			{
+				closestT = t;
 				outColl.mPoint = l.PointOnSegment(t);
 				outColl.mNormal = norm;
 				outColl.mBox = box;

+ 1 - 0
Chapter14/PhysWorld.cpp

@@ -33,6 +33,7 @@ bool PhysWorld::SegmentCast(const LineSegment& l, CollisionInfo& outColl)
 			// Is this closer than previous intersection?
 			if (t < closestT)
 			{
+				closestT = t;
 				outColl.mPoint = l.PointOnSegment(t);
 				outColl.mNormal = norm;
 				outColl.mBox = box;