From 02cb0f938b24e8ee927d45bbb71ee6a502e5e6ba Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 16 Jun 2022 10:57:15 +0200 Subject: [PATCH] Add old API with `Vector3` for CollisionData --- Source/Engine/Physics/CollisionData.cs | 72 ++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Source/Engine/Physics/CollisionData.cs diff --git a/Source/Engine/Physics/CollisionData.cs b/Source/Engine/Physics/CollisionData.cs new file mode 100644 index 000000000..d84711ff6 --- /dev/null +++ b/Source/Engine/Physics/CollisionData.cs @@ -0,0 +1,72 @@ +// Copyright (c) 2014-2022 Wojciech Figat. All rights reserved. + +using System; + +namespace FlaxEngine +{ + partial class CollisionData + { + /// + /// Cooks the mesh collision data and updates the virtual asset. action cannot be performed on a main thread. + /// [Deprecated on 16.06.2022, expires on 16.06.2024] + /// + /// + /// Can be used only for virtual assets (see and ). + /// + /// The collision data type. + /// The source geometry vertex buffer with vertices positions. Cannot be empty. + /// The source data index buffer (triangles list). Uses 32-bit stride buffer. Cannot be empty. Length must be multiple of 3 (as 3 vertices build a triangle). + /// The convex mesh generation flags. + /// The convex mesh vertex limit. Use values in range [8;255] + /// True if failed, otherwise false. + [Obsolete("Deprecated in 1.4")] + public bool CookCollision(CollisionDataType type, Vector3[] vertices, uint[] triangles, ConvexMeshGenerationFlags convexFlags = ConvexMeshGenerationFlags.None, int convexVertexLimit = 255) + { + if (vertices == null) + throw new ArgumentNullException(); + var tmp = new Float3[vertices.Length]; + for (int i = 0; i < tmp.Length; i++) + tmp[i] = vertices[i]; + return CookCollision(type, tmp, triangles, convexFlags, convexVertexLimit); + } + + /// + /// Cooks the mesh collision data and updates the virtual asset. action cannot be performed on a main thread. + /// [Deprecated on 16.06.2022, expires on 16.06.2024] + /// + /// + /// Can be used only for virtual assets (see and ). + /// + /// The collision data type. + /// The source geometry vertex buffer with vertices positions. Cannot be empty. + /// The source data index buffer (triangles list). Uses 32-bit stride buffer. Cannot be empty. Length must be multiple of 3 (as 3 vertices build a triangle). + /// The convex mesh generation flags. + /// The convex mesh vertex limit. Use values in range [8;255] + /// True if failed, otherwise false. + [Obsolete("Deprecated in 1.4")] + public bool CookCollision(CollisionDataType type, Vector3[] vertices, int[] triangles, ConvexMeshGenerationFlags convexFlags = ConvexMeshGenerationFlags.None, int convexVertexLimit = 255) + { + if (vertices == null) + throw new ArgumentNullException(); + var tmp = new Float3[vertices.Length]; + for (int i = 0; i < tmp.Length; i++) + tmp[i] = vertices[i]; + return CookCollision(type, tmp, triangles, convexFlags, convexVertexLimit); + } + + /// + /// Extracts the collision data geometry into list of triangles. + /// [Deprecated on 16.06.2022, expires on 16.06.2024] + /// + /// The output vertex buffer. + /// The output index buffer. + [Obsolete("Deprecated in 1.4")] + public void ExtractGeometry(out Vector3[] vertexBuffer, out int[] indexBuffer) + { + ExtractGeometry(out Float3[] tmp, out indexBuffer); + vertexBuffer = new Vector3[tmp.Length]; + for (int i = 0; i < tmp.Length; i++) + vertexBuffer[i] = tmp[i]; + } + } +}