Skip to content

Commit 3d8d233

Browse files
author
Unity Technologies
committed
com.unity.physics@1.3.14
## [1.3.14] - 2025-04-11 ### Changed * Updated the `com.unity.entities` dependency to version `1.3.14` * Updated the `com.unity.burst` dependency to version `1.8.19` * Updated the `com.unity.test-framework dependency` to version `1.4.6` * The minimum supported editor version is now 2022.3.20f1 ### Fixed * Incorrect capsule debug visualization when using non-default proportions in `PhysicsDebugDisplay`.
1 parent fb5ba33 commit 3d8d233

File tree

7 files changed

+372
-36
lines changed

7 files changed

+372
-36
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22
uid: unity-physics-changelog
33
---
44

5-
# Changelog
5+
6+
## [1.3.14] - 2025-04-11
7+
8+
### Changed
9+
10+
* Updated the `com.unity.entities` dependency to version `1.3.14`
11+
* Updated the `com.unity.burst` dependency to version `1.8.19`
12+
* Updated the `com.unity.test-framework dependency` to version `1.4.6`
13+
* The minimum supported editor version is now 2022.3.20f1
14+
15+
### Fixed
16+
17+
* Incorrect capsule debug visualization when using non-default proportions in `PhysicsDebugDisplay`.
18+
619

720
## [1.3.10] - 2025-02-17
821

Unity.Physics.Hybrid/Utilities/DebugDisplay/DebugMeshCache.cs

Lines changed: 285 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@ internal enum MeshType
1111
Cube = PrimitiveType.Cube,
1212
Plane = PrimitiveType.Plane,
1313
Quad = PrimitiveType.Quad,
14-
Icosahedron = 255 //temp
14+
OpenHemisphere,
15+
OpenCylinder,
16+
Icosahedron
1517
}
1618

1719
internal static class DebugMeshCache
1820
{
19-
static UnityEngine.Mesh s_Cube;
20-
static UnityEngine.Mesh s_Sphere;
21-
static UnityEngine.Mesh s_Capsule;
22-
static UnityEngine.Mesh s_Cylinder;
23-
static UnityEngine.Mesh s_Icosahedron;
21+
private static UnityEngine.Mesh s_Cube;
22+
private static UnityEngine.Mesh s_Sphere;
23+
private static UnityEngine.Mesh s_Capsule;
24+
private static UnityEngine.Mesh s_Cylinder;
25+
private static UnityEngine.Mesh s_Icosahedron;
26+
private static UnityEngine.Mesh s_OpenHemisphere;
27+
private static UnityEngine.Mesh s_OpenCylinder;
2428

2529
public static UnityEngine.Mesh GetMesh(PrimitiveType type)
2630
{
@@ -63,6 +67,21 @@ public static UnityEngine.Mesh GetMesh(MeshType type)
6367

6468
mesh = s_Icosahedron;
6569
break;
70+
71+
case MeshType.OpenHemisphere:
72+
if (!s_OpenHemisphere)
73+
s_OpenHemisphere = CreateOpenHemisphere();
74+
75+
mesh = s_OpenHemisphere;
76+
break;
77+
78+
case MeshType.OpenCylinder:
79+
if (!s_OpenCylinder)
80+
s_OpenCylinder = CreateOpenCylinder();
81+
82+
mesh = s_OpenCylinder;
83+
break;
84+
6685
default:
6786
throw new NotImplementedException($"Unable to create mesh of type {type}, handling not implemented");
6887
}
@@ -1938,5 +1957,265 @@ static UnityEngine.Mesh CreateCylinder()
19381957

19391958
return mesh;
19401959
}
1960+
1961+
static UnityEngine.Mesh CreateOpenHemisphere()
1962+
{
1963+
var mesh = new UnityEngine.Mesh
1964+
{
1965+
vertices = new Vector3[]
1966+
{
1967+
new Vector3(-0.14f, 0.22f, 0.43f),
1968+
new Vector3(-0.08f, 0.43f, 0.25f),
1969+
new Vector3(-0.34f, 0.26f, 0.25f),
1970+
new Vector3(0.36f, 0.22f, 0.26f),
1971+
new Vector3(0.21f, 0.43f, 0.15f),
1972+
new Vector3(0.13f, 0.26f, 0.40f),
1973+
new Vector3(0.36f, 0.22f, -0.26f),
1974+
new Vector3(0.21f, 0.43f, -0.15f),
1975+
new Vector3(0.43f, 0.26f, 0.00f),
1976+
new Vector3(-0.14f, 0.22f, -0.43f),
1977+
new Vector3(-0.08f, 0.43f, -0.25f),
1978+
new Vector3(0.13f, 0.26f, -0.40f),
1979+
new Vector3(-0.45f, 0.22f, 0.00f),
1980+
new Vector3(-0.26f, 0.43f, 0.00f),
1981+
new Vector3(-0.34f, 0.26f, -0.25f),
1982+
new Vector3(-0.26f, 0.43f, 0.00f),
1983+
new Vector3(0.00f, 0.50f, 0.00f),
1984+
new Vector3(-0.08f, 0.43f, -0.25f),
1985+
new Vector3(-0.26f, 0.43f, 0.00f),
1986+
new Vector3(-0.08f, 0.43f, -0.25f),
1987+
new Vector3(-0.34f, 0.26f, -0.25f),
1988+
new Vector3(-0.34f, 0.26f, -0.25f),
1989+
new Vector3(-0.08f, 0.43f, -0.25f),
1990+
new Vector3(-0.14f, 0.22f, -0.43f),
1991+
new Vector3(-0.08f, 0.43f, -0.25f),
1992+
new Vector3(0.00f, 0.50f, 0.00f),
1993+
new Vector3(0.21f, 0.43f, -0.15f),
1994+
new Vector3(-0.08f, 0.43f, -0.25f),
1995+
new Vector3(0.21f, 0.43f, -0.15f),
1996+
new Vector3(0.13f, 0.26f, -0.40f),
1997+
new Vector3(0.13f, 0.26f, -0.40f),
1998+
new Vector3(0.21f, 0.43f, -0.15f),
1999+
new Vector3(0.36f, 0.22f, -0.26f),
2000+
new Vector3(0.21f, 0.43f, -0.15f),
2001+
new Vector3(0.00f, 0.50f, 0.00f),
2002+
new Vector3(0.21f, 0.43f, 0.15f),
2003+
new Vector3(0.21f, 0.43f, -0.15f),
2004+
new Vector3(0.21f, 0.43f, 0.15f),
2005+
new Vector3(0.43f, 0.26f, 0.00f),
2006+
new Vector3(0.43f, 0.26f, 0.00f),
2007+
new Vector3(0.21f, 0.43f, 0.15f),
2008+
new Vector3(0.36f, 0.22f, 0.26f),
2009+
new Vector3(0.21f, 0.43f, 0.15f),
2010+
new Vector3(0.00f, 0.50f, 0.00f),
2011+
new Vector3(-0.08f, 0.43f, 0.25f),
2012+
new Vector3(0.21f, 0.43f, 0.15f),
2013+
new Vector3(-0.08f, 0.43f, 0.25f),
2014+
new Vector3(0.13f, 0.26f, 0.40f),
2015+
new Vector3(0.13f, 0.26f, 0.40f),
2016+
new Vector3(-0.08f, 0.43f, 0.25f),
2017+
new Vector3(-0.14f, 0.22f, 0.43f),
2018+
new Vector3(-0.08f, 0.43f, 0.25f),
2019+
new Vector3(0.00f, 0.50f, 0.00f),
2020+
new Vector3(-0.26f, 0.43f, 0.00f),
2021+
new Vector3(-0.08f, 0.43f, 0.25f),
2022+
new Vector3(-0.26f, 0.43f, 0.00f),
2023+
new Vector3(-0.34f, 0.26f, 0.25f),
2024+
new Vector3(-0.34f, 0.26f, 0.25f),
2025+
new Vector3(-0.26f, 0.43f, 0.00f),
2026+
new Vector3(-0.45f, 0.22f, 0.00f),
2027+
new Vector3(-0.48f, 0.00f, -0.15f),
2028+
new Vector3(-0.45f, 0.22f, 0.00f),
2029+
new Vector3(-0.34f, 0.26f, -0.25f),
2030+
new Vector3(-0.48f, 0.00f, -0.15f),
2031+
new Vector3(-0.34f, 0.26f, -0.25f),
2032+
new Vector3(-0.29f, 0.00f, -0.40f),
2033+
new Vector3(-0.29f, 0.00f, -0.40f),
2034+
new Vector3(-0.34f, 0.26f, -0.25f),
2035+
new Vector3(-0.14f, 0.22f, -0.43f),
2036+
new Vector3(0.00f, 0.00f, -0.50f),
2037+
new Vector3(-0.14f, 0.22f, -0.43f),
2038+
new Vector3(0.13f, 0.26f, -0.40f),
2039+
new Vector3(0.00f, 0.00f, -0.50f),
2040+
new Vector3(0.13f, 0.26f, -0.40f),
2041+
new Vector3(0.29f, 0.00f, -0.40f),
2042+
new Vector3(0.29f, 0.00f, -0.40f),
2043+
new Vector3(0.13f, 0.26f, -0.40f),
2044+
new Vector3(0.36f, 0.22f, -0.26f),
2045+
new Vector3(0.48f, 0.00f, -0.15f),
2046+
new Vector3(0.36f, 0.22f, -0.26f),
2047+
new Vector3(0.43f, 0.26f, 0.00f),
2048+
new Vector3(0.48f, 0.00f, -0.15f),
2049+
new Vector3(0.43f, 0.26f, 0.00f),
2050+
new Vector3(0.48f, 0.00f, 0.15f),
2051+
new Vector3(0.48f, 0.00f, 0.15f),
2052+
new Vector3(0.43f, 0.26f, 0.00f),
2053+
new Vector3(0.36f, 0.22f, 0.26f),
2054+
new Vector3(0.29f, 0.00f, 0.40f),
2055+
new Vector3(0.36f, 0.22f, 0.26f),
2056+
new Vector3(0.13f, 0.26f, 0.40f),
2057+
new Vector3(0.29f, 0.00f, 0.40f),
2058+
new Vector3(0.13f, 0.26f, 0.40f),
2059+
new Vector3(0.00f, 0.00f, 0.50f),
2060+
new Vector3(0.00f, 0.00f, 0.50f),
2061+
new Vector3(0.13f, 0.26f, 0.40f),
2062+
new Vector3(-0.14f, 0.22f, 0.43f),
2063+
new Vector3(-0.29f, 0.00f, 0.40f),
2064+
new Vector3(-0.14f, 0.22f, 0.43f),
2065+
new Vector3(-0.34f, 0.26f, 0.25f),
2066+
new Vector3(-0.29f, 0.00f, 0.40f),
2067+
new Vector3(-0.34f, 0.26f, 0.25f),
2068+
new Vector3(-0.48f, 0.00f, 0.15f),
2069+
new Vector3(-0.48f, 0.00f, 0.15f),
2070+
new Vector3(-0.34f, 0.26f, 0.25f),
2071+
new Vector3(-0.45f, 0.22f, 0.00f),
2072+
new Vector3(-0.29f, 0.00f, -0.40f),
2073+
new Vector3(-0.14f, 0.22f, -0.43f),
2074+
new Vector3(0.00f, 0.00f, -0.50f),
2075+
new Vector3(0.29f, 0.00f, -0.40f),
2076+
new Vector3(0.36f, 0.22f, -0.26f),
2077+
new Vector3(0.48f, 0.00f, -0.15f),
2078+
new Vector3(0.48f, 0.00f, 0.15f),
2079+
new Vector3(0.36f, 0.22f, 0.26f),
2080+
new Vector3(0.29f, 0.00f, 0.40f),
2081+
new Vector3(0.00f, 0.00f, 0.50f),
2082+
new Vector3(-0.14f, 0.22f, 0.43f),
2083+
new Vector3(-0.29f, 0.00f, 0.40f),
2084+
new Vector3(-0.48f, 0.00f, 0.15f),
2085+
new Vector3(-0.45f, 0.22f, 0.00f),
2086+
new Vector3(-0.48f, 0.00f, -0.15f),
2087+
}
2088+
};
2089+
2090+
mesh.SetIndices(new int[]
2091+
{
2092+
0, 1, 2,
2093+
3, 4, 5,
2094+
6, 7, 8,
2095+
9, 10, 11,
2096+
12, 13, 14,
2097+
15, 16, 17,
2098+
18, 19, 20,
2099+
21, 22, 23,
2100+
24, 25, 26,
2101+
27, 28, 29,
2102+
30, 31, 32,
2103+
33, 34, 35,
2104+
36, 37, 38,
2105+
39, 40, 41,
2106+
42, 43, 44,
2107+
45, 46, 47,
2108+
48, 49, 50,
2109+
51, 52, 53,
2110+
54, 55, 56,
2111+
57, 58, 59,
2112+
60, 61, 62,
2113+
63, 64, 65,
2114+
66, 67, 68,
2115+
69, 70, 71,
2116+
72, 73, 74,
2117+
75, 76, 77,
2118+
78, 79, 80,
2119+
81, 82, 83,
2120+
84, 85, 86,
2121+
87, 88, 89,
2122+
90, 91, 92,
2123+
93, 94, 95,
2124+
96, 97, 98,
2125+
99, 100, 101,
2126+
102, 103, 104,
2127+
105, 106, 107,
2128+
108, 109, 110,
2129+
111, 112, 113,
2130+
114, 115, 116,
2131+
117, 118, 119
2132+
}, MeshTopology.Triangles, 0);
2133+
2134+
mesh.Optimize();
2135+
mesh.RecalculateNormals();
2136+
mesh.UploadMeshData(false);
2137+
2138+
return mesh;
2139+
}
2140+
2141+
static UnityEngine.Mesh CreateOpenCylinder()
2142+
{
2143+
var mesh = new UnityEngine.Mesh
2144+
{
2145+
vertices = new Vector3[]
2146+
{
2147+
new Vector3(0.00f, -0.50f, -0.50f),
2148+
new Vector3(-0.29f, -0.50f, -0.40f),
2149+
new Vector3(-0.29f, 0.50f, -0.40f),
2150+
new Vector3(0.00f, 0.50f, -0.50f),
2151+
new Vector3(-0.29f, -0.50f, -0.40f),
2152+
new Vector3(-0.48f, -0.50f, -0.15f),
2153+
new Vector3(-0.48f, 0.50f, -0.15f),
2154+
new Vector3(-0.29f, 0.50f, -0.40f),
2155+
new Vector3(-0.48f, -0.50f, -0.15f),
2156+
new Vector3(-0.48f, -0.50f, 0.15f),
2157+
new Vector3(-0.48f, 0.50f, 0.15f),
2158+
new Vector3(-0.48f, 0.50f, -0.15f),
2159+
new Vector3(-0.48f, -0.50f, 0.15f),
2160+
new Vector3(-0.29f, -0.50f, 0.40f),
2161+
new Vector3(-0.29f, 0.50f, 0.40f),
2162+
new Vector3(-0.48f, 0.50f, 0.15f),
2163+
new Vector3(-0.29f, -0.50f, 0.40f),
2164+
new Vector3(0.00f, -0.50f, 0.50f),
2165+
new Vector3(0.00f, 0.50f, 0.50f),
2166+
new Vector3(-0.29f, 0.50f, 0.40f),
2167+
new Vector3(0.00f, -0.50f, 0.50f),
2168+
new Vector3(0.29f, -0.50f, 0.40f),
2169+
new Vector3(0.29f, 0.50f, 0.40f),
2170+
new Vector3(0.00f, 0.50f, 0.50f),
2171+
new Vector3(0.29f, -0.50f, 0.40f),
2172+
new Vector3(0.48f, -0.50f, 0.15f),
2173+
new Vector3(0.48f, 0.50f, 0.15f),
2174+
new Vector3(0.29f, 0.50f, 0.40f),
2175+
new Vector3(0.48f, -0.50f, 0.15f),
2176+
new Vector3(0.48f, -0.50f, -0.15f),
2177+
new Vector3(0.48f, 0.50f, -0.15f),
2178+
new Vector3(0.48f, 0.50f, 0.15f),
2179+
new Vector3(0.48f, -0.50f, -0.15f),
2180+
new Vector3(0.29f, -0.50f, -0.40f),
2181+
new Vector3(0.29f, 0.50f, -0.40f),
2182+
new Vector3(0.48f, 0.50f, -0.15f),
2183+
new Vector3(0.29f, -0.50f, -0.40f),
2184+
new Vector3(0.00f, -0.50f, -0.50f),
2185+
new Vector3(0.00f, 0.50f, -0.50f),
2186+
new Vector3(0.29f, 0.50f, -0.40f)
2187+
}
2188+
};
2189+
2190+
mesh.SetIndices(new int[]
2191+
{
2192+
0, 1, 2,
2193+
0, 2, 3,
2194+
4, 5, 6,
2195+
4, 6, 7,
2196+
8, 9, 10,
2197+
8, 10, 11,
2198+
12, 13, 14,
2199+
12, 14, 15,
2200+
16, 17, 18,
2201+
16, 18, 19,
2202+
20, 21, 22,
2203+
20, 22, 23,
2204+
24, 25, 26,
2205+
24, 26, 27,
2206+
28, 29, 30,
2207+
28, 30, 31,
2208+
32, 33, 34,
2209+
32, 34, 35,
2210+
36, 37, 38,
2211+
36, 38, 39
2212+
}, MeshTopology.Triangles, 0);
2213+
2214+
mesh.Optimize();
2215+
mesh.RecalculateNormals();
2216+
mesh.UploadMeshData(false);
2217+
2218+
return mesh;
2219+
}
19412220
}
19422221
}

Unity.Physics.Hybrid/Utilities/DebugDisplay/DebugStream.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,23 @@ public static void Box(float3 Size, float3 Center, quaternion Orientation, Color
286286
/// <param name="vertices"> An array of vertices. </param>
287287
/// <param name="triangleIndices"> An array of triangle indices pointing into the vertices array. A triangle is drawn from every triplet of triangle indices. </param>
288288
/// <param name="color"> Color. </param>
289-
public static void Triangles(in NativeArray<float3> vertices, in NativeArray<int> triangleIndices, ColorIndex color)
289+
public static void Triangles(in NativeArray<float3> vertices, in NativeArray<int> triangleIndices, ColorIndex color) => Triangles(vertices, triangleIndices, color, false);
290+
291+
/// <summary>
292+
/// Draws multiple triangles from the provided data arrays.
293+
/// </summary>
294+
/// <param name="vertices"> An array of vertices. </param>
295+
/// <param name="triangleIndices"> An array of triangle indices pointing into the vertices array. A triangle is drawn from every triplet of triangle indices. </param>
296+
/// <param name="color"> Color. </param>
297+
/// <param name="reverseWinding"> If true, the winding order of the triangles is reversed. </param>
298+
internal static void Triangles(in NativeArray<float3> vertices, in NativeArray<int> triangleIndices, ColorIndex color, bool reverseWinding)
290299
{
291300
var triangles = new Triangles(triangleIndices.Length / 3);
292301
for (int i = 0; i < triangleIndices.Length; i += 3)
293302
{
294303
var v0 = vertices[triangleIndices[i]];
295-
var v1 = vertices[triangleIndices[i + 1]];
296-
var v2 = vertices[triangleIndices[i + 2]];
304+
var v1 = vertices[triangleIndices[i + (reverseWinding ? 2 : 1)]];
305+
var v2 = vertices[triangleIndices[i + (reverseWinding ? 1 : 2)]];
297306

298307
float3 normal = math.normalize(math.cross(v1 - v0, v2 - v0));
299308
triangles.Draw(v0, v1, v2, normal, color);

Unity.Physics.Hybrid/Utilities/DebugDisplay/DisplayCollidersSystem.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,14 @@ private unsafe void DrawColliderFaces(Collider* collider, RigidTransform worldFr
9191

9292
case ColliderType.Capsule:
9393
radius = ((CapsuleCollider*)collider)->Radius;
94-
9594
var vertex0 = ((CapsuleCollider*)collider)->Vertex0;
9695
var vertex1 = ((CapsuleCollider*)collider)->Vertex1;
9796
var axis = vertex1 - vertex0; //axis in wfc-space
98-
99-
height = 0.5f * math.length(axis) + radius;
100-
101-
colliderPosition = (vertex1 + vertex0) / 2.0f; //axis in wfc-space
97+
height = math.length(axis); // cylinder height
98+
colliderPosition = (vertex1 + vertex0) * 0.5f;
10299
colliderOrientation = Quaternion.FromToRotation(Vector3.up, -axis);
103100

104-
DrawColliderUtility.DrawPrimitiveCapsuleFaces(radius, height, colliderPosition, colliderOrientation, worldFromCollider, ref Geometries.CapsuleGeometry, color, uniformScale);
101+
DrawColliderUtility.DrawPrimitiveCapsuleFaces(radius, height, colliderPosition, colliderOrientation, worldFromCollider, ref Geometries.OpenCylinder, ref Geometries.OpenHemisphere, color, uniformScale);
105102

106103
break;
107104

0 commit comments

Comments
 (0)