Skip to content

Commit f78dd63

Browse files
author
Unity Technologies
committed
com.unity.physics@1.4.4
## [1.4.4] - 2025-12-16 ### Changed * Updated the Burst dependency to version 1.8.25 * Updated the `com.unity.entities` dependency to version `1.4.4` ### Fixed * `CollisionFilter.IsEmpty` now correctly accounts for the `CollisionFilter.GroupIndex` value. * Fixed a bug when calling StepImmediate while using a SimulationStepInput struct which did not specify NumSubsteps would result in incorrect simulation. This would be observed for a project using StepImmediate that was created pre v1.4 * Correctly set Connected Anchor of built-in joints in baked entity prefabs when Auto Configure Connected Anchor is enabled. * The `BoxCollider.BakeTransform` method now correctly limits the box bevel radius to half the minimum size of the new box, preventing invalid box collider properties. * Ensure that `PhysicsColliders` are unique when they are baked from unique `Physics Shape` or built-in `Collider` authoring components that are located within `GameObject` prefab instances. This fix addresses a regression introduced in a recent 1.4.x version, which caused baked colliders in this case to not be unique unexpectedly. * Make sure that the static broadphase in custom physics worlds is now updated correctly when the "Shared Static Colliders" option is used and static colliders are modified (see constructor `CustomPhysicsSystemGroup(uint worldIndex, bool shareStaticColliders)`). Prior to this fix, when moving or modifying the geometry of a static collider, collisions with static colliders would get missed in custom physics worlds. * The mass properties of compound colliders containing only polygon colliders now no longer contain NaN values.
1 parent f6282d7 commit f78dd63

34 files changed

+804
-219
lines changed

.attestation.p7m

0 Bytes
Binary file not shown.

.signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":1761776372,"signature":"krQqtAByNOQwGNdhLhAFmIecxXOjoelhyIxH4tz0QujVIkhzbTIv2YI/o4C+C6iS+WXOjR9y2jdyHBQfdZISz3IdXyrRtCuXxrGuwh6W26rHOLPQJJrXITUiHrE6tif7GGm0w/fg5nj3y2BNQEGPvlWnc3bs8JTg52lj0fYu59772jlHxuDDyXvl8KS81dezP2jG19ZML1o47lopPDQcEh0VSv5Xrp5SMB2EpyQVo7wQkTQSQ2dScMSyaRVh9hgGVavVgxPXZnX6vYTcyOSaIOP3j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kYXpMYlpzUEE2aHBSK0FJRTJhc0tLTi84UUk1N3UzU2cKL2xyMnZKS1IvU2l5eEN1Q20vQWJkYnJMbXk0WjlSdm1jMGdpclA4T0lLQWxBRWZ2TzV5Z2hSKy8vd1RpTFlzUQp1SllDM0V2UE16ZGdKUzdGR2FscnFLZzlPTCsxVzROY05yNWdveVdSUUJ0cktKaWlTZEJVWmVxb0RvSUY5NHpCCndGbzJJT1JFdXFqcU51M3diMWZIM3p1dGdtalFra3IxVjJhd3hmcExLWlROQWdNQkFBRT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg"}

CHANGELOG.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,39 @@ uid: unity-physics-changelog
44

55
# Changelog
66

7-
## [1.4.3] - 2025-10-17
7+
## [1.4.4] - 2025-12-16
88

9-
### Added
10-
11-
* The Force Unique Collider companion component can now be disabled in the Inspector. When disabled it will no longer cause its associated baked Unity Physics Colliders to be unique.
129

1310
### Changed
1411

1512
* Updated the Burst dependency to version 1.8.25
13+
* Updated the `com.unity.entities` dependency to version `1.4.4`
1614

17-
### Deprecated
15+
### Fixed
1816

17+
* `CollisionFilter.IsEmpty` now correctly accounts for the `CollisionFilter.GroupIndex` value.
18+
* Fixed a bug when calling StepImmediate while using a SimulationStepInput struct which did not specify NumSubsteps would result in incorrect simulation. This would be observed for a project using StepImmediate that was created pre v1.4
19+
* Correctly set Connected Anchor of built-in joints in baked entity prefabs when Auto Configure Connected Anchor is enabled.
20+
* The `BoxCollider.BakeTransform` method now correctly limits the box bevel radius to half the minimum size of the new box, preventing invalid box collider properties.
21+
* Ensure that `PhysicsColliders` are unique when they are baked from unique `Physics Shape` or built-in `Collider` authoring components that are located within `GameObject` prefab instances. This fix addresses a regression introduced in a recent 1.4.x version, which caused baked colliders in this case to not be unique unexpectedly.
22+
* Make sure that the static broadphase in custom physics worlds is now updated correctly when the "Shared Static Colliders" option is used and static colliders are modified (see constructor `CustomPhysicsSystemGroup(uint worldIndex, bool shareStaticColliders)`). Prior to this fix, when moving or modifying the geometry of a static collider, collisions with static colliders would get missed in custom physics worlds.
23+
* The mass properties of compound colliders containing only polygon colliders now no longer contain NaN values.
1924

20-
### Removed
2125

26+
## [1.4.3] - 2025-10-17
27+
28+
### Added
29+
30+
* The Force Unique Collider companion component can now be disabled in the Inspector. When disabled it will no longer cause its associated baked Unity Physics Colliders to be unique.
31+
32+
### Changed
33+
34+
* Updated the Burst dependency to version 1.8.25
2235

2336
### Fixed
2437

2538
* Baked Unity Physics Colliders that are forced to be unique will now produce stable collider blob hashes. This ensures that associated artifact IDs in your project will no longer change each time the project is re-imported. Note that baked colliders can be forced to be unique either via the "Force Unique" option in the custom Physics Shape authoring component, or via the Force Unique Collider companion component for built-in Colliders. Both approaches now support stable collider blob hashes.
2639

27-
### Security
28-
2940

3041
## [1.4.2] - 2025-09-05
3142

Samples~/CustomPhysicsAuthoring/Unity.Physics.Custom.Editor/EditorTools/CustomComponentVersionUpgrader.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using UnityEditor;
1+
using System;
2+
using UnityEditor;
23

34
#if UNITY_EDITOR
45

@@ -9,7 +10,9 @@ static class CustomComponentVersionUpgrader
910
[MenuItem("Tools/Unity Physics/Upgrade Physics Shape Versions")]
1011
static void UpgradeAssetsWithPhysicsShape()
1112
{
12-
ComponentVersionUpgrader.UpgradeAssets<Authoring.PhysicsShapeAuthoring>("Physics Shape");
13+
var componentNeedsUpgradeFunction = new Func<Authoring.PhysicsShapeAuthoring, bool>(
14+
component => component.NeedsVersionUpgrade);
15+
ComponentVersionUpgrader.UpgradeAssets("Physics Shape", componentNeedsUpgradeFunction);
1316
}
1417
}
1518
}

Samples~/CustomPhysicsAuthoring/Unity.Physics.Custom/Bodies/PhysicsShapeAuthoring.cs

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ public sealed class PhysicsShapeAuthoring : MonoBehaviour, IInheritPhysicsMateri
3131

3232
PhysicsShapeAuthoring() {}
3333

34-
internal uint ForceUniqueID => m_ForceUniqueID;
35-
[SerializeField]
34+
internal uint ForceUniqueID => m_ForceUniqueID ^ m_PrefabInstanceID; // Note: incorporate prefab instance ID for uniqueness in prefab instances
35+
[SerializeField, HideInInspector]
3636
uint m_ForceUniqueID = 0;
3737

38+
[SerializeField, HideInInspector]
39+
uint m_PrefabInstanceID = 0;
40+
3841
[Serializable]
3942
struct CylindricalProperties
4043
{
@@ -742,11 +745,15 @@ void OnEnable()
742745
}
743746

744747
const int k_VersionAddedForceUniqueID = 2; // added ForceUniqueID for stable artifact IDs
745-
const int k_LatestVersion = k_VersionAddedForceUniqueID;
748+
const int k_VersionAddedPrefabInstanceID = 3; // added m_PrefabInstanceID for unique ForceUniqueID across prefab instances
749+
const int k_LatestVersion = k_VersionAddedPrefabInstanceID;
746750

747751
[SerializeField, HideInInspector]
748752
int m_SerializedVersion = k_LatestVersion;
749753

754+
internal bool NeedsVersionUpgrade => m_NeedsVersionUpgrade;
755+
bool m_NeedsVersionUpgrade = false;
756+
750757
#if UNITY_EDITOR
751758
static string s_LastWarnedPath;
752759
static double s_NextWarningTime;
@@ -758,6 +765,8 @@ void UpgradeVersionIfNecessary()
758765
{
759766
m_SerializedVersion = k_LatestVersion;
760767

768+
m_NeedsVersionUpgrade = true;
769+
761770
#if UNITY_EDITOR
762771
if (PrefabUtility.IsPartOfAnyPrefab(this) || gameObject.scene.IsValid())
763772
{
@@ -798,6 +807,34 @@ void OnValidate()
798807
m_ForceUniqueID = (uint)UnityEngine.Random.Range(1, Int32.MaxValue);
799808
}
800809

810+
#if UNITY_EDITOR
811+
// Case: Unique shape in a prefab instance:
812+
// The force unique IDs of multiple physics shape instances stemming from the same prefab will all be identical.
813+
// So, in order to assign their resultant baked colliders a unique "force unique id", thereby ensuring
814+
// that the resultant baked colliders are indeed unique, we need to incorporate an extra unique identifier
815+
// representing the prefab instance into the force unique ID (see ForceUniqueID property above).
816+
// This can be achieved using the targetPrefabId from the GlobalObjectId of the shape's game object, which is
817+
// guaranteed to be unique for each prefab instance in the scene and stable across reloads and sessions.
818+
819+
var objectId = GlobalObjectId.GetGlobalObjectIdSlow(gameObject);
820+
var prefabInstanceID = (uint)objectId.targetPrefabId;
821+
if (prefabInstanceID != m_PrefabInstanceID)
822+
{
823+
// Note: we get here if this component is part of a prefab instance, either newly created (in which
824+
// case m_PrefabInstanceID is zero initially) or duplicated (in which case the current m_PrefabInstanceID
825+
// matches that of the original prefab instance and needs to be updated to the id of the new instance
826+
// in order to be unique).
827+
828+
// Explicitly mark prefab instance as dirty so that the change gets saved alongside the prefab instance.
829+
// Otherwise, the m_PrefabInstanceID value in the prefab would be used, which is not unique
830+
// and would thus not allow creating unique colliders.
831+
Undo.RecordObject(this, "Acquire Prefab Instance ID");
832+
PrefabUtility.RecordPrefabInstancePropertyModifications(this);
833+
834+
m_PrefabInstanceID = prefabInstanceID;
835+
}
836+
#endif
837+
801838
m_PrimitiveSize = math.max(m_PrimitiveSize, new float3());
802839
Validate(ref m_Capsule);
803840
Validate(ref m_Cylinder);

Tests/EditModeTests/AErrorVerification_UnitTests.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.

Tests/EditModeTests/AErrorVerification_UnitTests.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Tests/EditModeTests/Authoring/PhysicsJointConversionSystem_IntegrationTests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using NUnit.Framework;
33
using Unity.Mathematics;
4+
using Unity.Physics.Authoring;
45
using UnityEngine;
56

67
namespace Unity.Physics.Tests.Authoring
@@ -120,6 +121,37 @@ public void ConversionSystems_WhenGOHasJoint_AndHasInfinityBreakValues_ImpulseEv
120121
}, count);
121122
}
122123

124+
/// <summary>
125+
/// Tests that the PhysicsWorldIndexAuthoring component on a GO joint component correctly bakes
126+
/// into the PhysicsWorldIndex component value on the converted joint entity.
127+
/// </summary>
128+
[TestCaseSource(nameof(JointTestCases))]
129+
public void ConversionSystems_WhenGOHasJoint_WithPhysicsWorldIndexAuthoring_JointEntityHasCorrectWorldIndex(Type jointType, int count)
130+
{
131+
CreateHierarchy(new[] { jointType }, Array.Empty<Type>(), Array.Empty<Type>());
132+
var joint = Root.GetComponent<UnityEngine.Joint>();
133+
LockXIfConfigurableJoint(joint);
134+
135+
var physicsWorldComponent = Root.AddComponent<PhysicsWorldIndexAuthoring>();
136+
137+
// pick a non-default world index to verify the value is correctly baked into the underlying PhysicsWorldIndex component.
138+
physicsWorldComponent.WorldIndex += 1;
139+
var expectedPhysicsWorldIndex = physicsWorldComponent.WorldIndex;
140+
141+
TestConvertedData<PhysicsJoint>((world, entities, joints) =>
142+
{
143+
foreach (var entity in entities)
144+
{
145+
var hasJoint = world.EntityManager.HasComponent<PhysicsJoint>(entity);
146+
Assert.That(hasJoint, Is.True);
147+
var hasPhysicsWorldIndex = world.EntityManager.HasComponent<PhysicsWorldIndex>(entity);
148+
Assert.That(hasPhysicsWorldIndex, Is.True);
149+
var authoring = world.EntityManager.GetSharedComponent<PhysicsWorldIndex>(entity);
150+
Assert.That(authoring.Value, Is.EqualTo(expectedPhysicsWorldIndex));
151+
}
152+
}, count);
153+
}
154+
123155
[Test]
124156
public void ConversionSystems_WhenGOHasSpringJoint_IsMinDistanceValueSet()
125157
{

0 commit comments

Comments
 (0)