Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Commit

Permalink
Add Collider.ComputePenetration
Browse files Browse the repository at this point in the history
  • Loading branch information
mafiesto4 committed Sep 4, 2019
1 parent 301b738 commit e9db510
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions FlaxEngine/API/Actors/Collider.Gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ public RigidBody AttachedRigidBody
#endif
}

/// <summary>
/// Computes minimum translational distance between two geometry objects. Translating the first collider by direction * distance will separate the colliders apart if the function returned true. Otherwise, direction and distance are not defined. The one of the colliders has to be BoxCollider, SphereCollider CapsuleCollider or a convex MeshCollider. The other one can be any type.
/// </summary>
/// <param name="colliderA">The first collider.</param>
/// <param name="colliderB">The second collider.</param>
/// <param name="direction">The computed direction along which the translation required to separate the colliders apart is minimal. Valid only if function returns true.</param>
/// <param name="distance">The penetration distance along direction that is required to separate the colliders apart. Valid only if function returns true.</param>
/// <returns>True if the distance has successfully been computed, i.e. if objects do overlap, otherwise false.</returns>
#if UNIT_TEST_COMPILANT
[Obsolete("Unit tests, don't support methods calls.")]
#endif
[UnmanagedCall]
public static bool ComputePenetration(Collider colliderA, Collider colliderB, out Vector3 direction, out float distance)
{
#if UNIT_TEST_COMPILANT
throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set.");
#else
return Internal_ComputePenetration(Object.GetUnmanagedPtr(colliderA), Object.GetUnmanagedPtr(colliderB), out direction, out distance);
#endif
}

#region Internal Calls

#if !UNIT_TEST_COMPILANT
Expand Down Expand Up @@ -123,6 +144,9 @@ public RigidBody AttachedRigidBody

[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern RigidBody Internal_GetAttachedRigidBody(IntPtr obj);

[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Internal_ComputePenetration(IntPtr colliderA, IntPtr colliderB, out Vector3 direction, out float distance);
#endif

#endregion
Expand Down

0 comments on commit e9db510

Please sign in to comment.