diff --git a/Source/Engine/Physics/Physics.cpp b/Source/Engine/Physics/Physics.cpp
index 80f17873d..6b3889e99 100644
--- a/Source/Engine/Physics/Physics.cpp
+++ b/Source/Engine/Physics/Physics.cpp
@@ -223,6 +223,11 @@ bool Physics::LineCast(const Vector3& start, const Vector3& end, uint32 layerMas
return DefaultScene->LineCast(start, end, layerMask, hitTriggers);
}
+bool Physics::LineCast(const Vector3& start, const Vector3& end, API_PARAM(Out)RayCastHit& hitInfo, uint32 layerMask, bool hitTriggers)
+{
+ return DefaultScene->LineCast(start, end, hitInfo, layerMask, hitTriggers);
+}
+
bool Physics::RayCast(const Vector3& origin, const Vector3& direction, const float maxDistance, uint32 layerMask, bool hitTriggers)
{
return DefaultScene->RayCast(origin, direction, maxDistance, layerMask, hitTriggers);
@@ -462,6 +467,13 @@ bool PhysicsScene::LineCast(const Vector3& start, const Vector3& end, uint32 lay
return PhysicsBackend::RayCast(_scene, start, directionToEnd, distanceToEnd, layerMask, hitTriggers);
}
+bool PhysicsScene::LineCast(const Vector3& start, const Vector3& end, API_PARAM(Out)RayCastHit& hitInfo, uint32 layerMask, bool hitTriggers)
+{
+ float distanceToEnd = Vector3::Distance(start, end);
+ Vector3 directionToEnd = (end - start).GetNormalized();
+ return PhysicsBackend::RayCast(_scene, start, directionToEnd, hitInfo, distanceToEnd, layerMask, hitTriggers);
+}
+
bool PhysicsScene::RayCast(const Vector3& origin, const Vector3& direction, const float maxDistance, uint32 layerMask, bool hitTriggers)
{
return PhysicsBackend::RayCast(_scene, origin, direction, maxDistance, layerMask, hitTriggers);
diff --git a/Source/Engine/Physics/Physics.h b/Source/Engine/Physics/Physics.h
index 592f3c651..9fede6222 100644
--- a/Source/Engine/Physics/Physics.h
+++ b/Source/Engine/Physics/Physics.h
@@ -105,6 +105,17 @@ public:
/// True if ray hits an matching object, otherwise false.
API_FUNCTION() static bool LineCast(const Vector3& start, const Vector3& end, uint32 layerMask = MAX_uint32, bool hitTriggers = true);
+ ///
+ /// Performs a line between two points in the scene.
+ ///
+ /// The start position of the line.
+ /// The end position of the line.
+ /// The result hit information. Valid only when method returns true.
+ /// The layer mask used to filter the results.
+ /// If set to true triggers will be hit, otherwise will skip them.
+ /// True if ray hits an matching object, otherwise false.
+ API_FUNCTION() static bool LineCast(const Vector3& start, const Vector3& end, API_PARAM(Out) RayCastHit& hitInfo, uint32 layerMask = MAX_uint32, bool hitTriggers = true);
+
///
/// Performs a raycast against objects in the scene.
///
diff --git a/Source/Engine/Physics/PhysicsScene.h b/Source/Engine/Physics/PhysicsScene.h
index 946c35661..3bd98e9c0 100644
--- a/Source/Engine/Physics/PhysicsScene.h
+++ b/Source/Engine/Physics/PhysicsScene.h
@@ -136,6 +136,18 @@ public:
/// If set to true triggers will be hit, otherwise will skip them.
/// True if ray hits an matching object, otherwise false.
API_FUNCTION() bool LineCast(const Vector3& start, const Vector3& end, uint32 layerMask = MAX_uint32, bool hitOnTriggers = true);
+
+ ///
+ /// Performs a line between two points in the scene.
+ ///
+ /// The start position of the line.
+ /// The end position of the line.
+ /// The result hit information. Valid only when method returns true.
+ /// The layer mask used to filter the results.
+ /// If set to true triggers will be hit, otherwise will skip them.
+ /// True if ray hits an matching object, otherwise false.
+ API_FUNCTION() bool LineCast(const Vector3& start, const Vector3& end, API_PARAM(Out) RayCastHit& hitInfo, uint32 layerMask = MAX_uint32, bool hitOnTriggers = true);
+
///
/// Performs a raycast against objects in the scene.
///