|
@@ -436,16 +436,16 @@ void PhysicsWorld::RaycastSingleSegmented(PhysicsRaycastResult& result, const Ra
|
|
|
if (maxDistance >= M_INFINITY)
|
|
if (maxDistance >= M_INFINITY)
|
|
|
URHO3D_LOGWARNING("Infinite maxDistance in physics raycast is not supported");
|
|
URHO3D_LOGWARNING("Infinite maxDistance in physics raycast is not supported");
|
|
|
|
|
|
|
|
|
|
+ const btVector3 direction = ToBtVector3(ray.direction_);
|
|
|
|
|
+ const auto count = CeilToInt(maxDistance / segmentDistance);
|
|
|
|
|
+
|
|
|
btVector3 start = ToBtVector3(ray.origin_);
|
|
btVector3 start = ToBtVector3(ray.origin_);
|
|
|
- btVector3 end;
|
|
|
|
|
- btVector3 direction = ToBtVector3(ray.direction_);
|
|
|
|
|
float remainingDistance = maxDistance;
|
|
float remainingDistance = maxDistance;
|
|
|
- auto count = RoundToInt(maxDistance / segmentDistance);
|
|
|
|
|
|
|
|
|
|
for (auto i = 0; i < count; ++i)
|
|
for (auto i = 0; i < count; ++i)
|
|
|
{
|
|
{
|
|
|
- float distance = Min(remainingDistance, segmentDistance); // The last segment may be shorter
|
|
|
|
|
- end = start + distance * direction;
|
|
|
|
|
|
|
+ const float distance = Min(remainingDistance, segmentDistance); // The last segment may be shorter
|
|
|
|
|
+ const btVector3 end = start + distance * direction;
|
|
|
|
|
|
|
|
btCollisionWorld::ClosestRayResultCallback rayCallback(start, end);
|
|
btCollisionWorld::ClosestRayResultCallback rayCallback(start, end);
|
|
|
rayCallback.m_collisionFilterGroup = (short)0xffff;
|
|
rayCallback.m_collisionFilterGroup = (short)0xffff;
|