Use mesh collision proxy if available.
This commit is contained in:
@@ -633,5 +633,14 @@ namespace FlaxEngine
|
||||
throw new Exception("Failed to download mesh data.");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collision proxy points for the mesh.
|
||||
/// </summary>
|
||||
/// <returns>The triangle points in the collision proxy.</returns>
|
||||
public Float3[] GetCollisionProxyPoints()
|
||||
{
|
||||
return Internal_GetCollisionProxyPoints(__unmanagedPtr, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -847,4 +847,17 @@ MArray* Mesh::DownloadBuffer(bool forceGpu, MTypeObject* resultType, int32 typeI
|
||||
return result;
|
||||
}
|
||||
|
||||
Array<Float3> Mesh::GetCollisionProxyPoints() const
|
||||
{
|
||||
Array<Vector3> result;
|
||||
for (int i = 0; i < _collisionProxy.Triangles.Count(); ++i)
|
||||
{
|
||||
auto triangle = _collisionProxy.Triangles[i];
|
||||
result.Add(triangle.V0);
|
||||
result.Add(triangle.V1);
|
||||
result.Add(triangle.V2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -320,5 +320,6 @@ private:
|
||||
API_FUNCTION(NoProxy) bool UpdateTrianglesUInt(int32 triangleCount, const MArray* trianglesObj);
|
||||
API_FUNCTION(NoProxy) bool UpdateTrianglesUShort(int32 triangleCount, const MArray* trianglesObj);
|
||||
API_FUNCTION(NoProxy) MArray* DownloadBuffer(bool forceGpu, MTypeObject* resultType, int32 typeI);
|
||||
API_FUNCTION(NoProxy) Array<Float3> GetCollisionProxyPoints() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user