You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## [1.4.0-pre.4] - 2025-07-11
### Added
* New `TerrainCollider.Create` function variant that allows customizing the triangulation pattern of the created terrain collider's cells by flipping their inner diagonal edge, thus enabling users to align the physics collision representation with their visual terrain mesh.
* A newly introduced Detailed Static Mesh Collision feature enables enhanced collision detection precision for interactions with static meshes, effectively eliminating ghost collisions that can otherwise frequently occur in the presence of small mesh triangles or at high motion speeds. To enable the feature select the "Detailed Static Mesh Collision" option in the "Advanced" section of your custom `PhysicsShapeAuthoring` component, or, If you are using built-in `Collider` components, add the new `DetailedStaticMeshCollisionAuthoring` component alongside your collider. For runtime-generated colliders, please use the `EnableDetailedStaticMeshCollision` parameter in the physics material.
* Integrity checks for incremental broadphase. When integrity checks are enabled (see Project Settings -> Physics -> Unity Physics -> Enable Integrity Checks) the `PhysicsTemporalCoherenceInfo` component data of rigid body entities is validated against the internal state of the broadphase, to make sure the data is as expected. This allows detecting unexpected external modifications to this important bookkeeping data.
### Changed
* Parallelize jacobian updates for substepping without consideration of solver phases since there are no data dependencies
* Safer access to nodes in `BoundingVolumeHierarchy` of broadphase, ensuring there are no out-of-bounds accesses.
### Fixed
* Fixed a crash when scheduling an IBodyPairsJob and an IJacobiansJob in a situation without any body pairs or jacobians present in the simulation.
* Division by zero errors causing NaN values when a Capsule degenerates into a Sphere (occurs when Height = 2*Radius)
* ConvexHull connectivity for flat convex colliders
* Referenced prefabs in bakers with built-in joints incorrectly displayed the anchor position when the `Auto Configure Connected Anchor` flag was enabled.
* Correctly compute the expansion space for convex / composite collision queries, preventing missed collisions in certain cases.
* Pass the "Build Static Tree" flag to tree build job in single-threaded version of static tree update.
* A specific use case has been patched which applies only to Mac Silicon devices using editor version 2022.3 and when a negative scale is used in the transform of a BoxCollider: The transform calculation from localToWorld matrix to quaternion doesn't return the correct value due to differences in the calculation of rsqrt(x). This is exhibited as BoxGeometry orientations returning a strange quaternion value when the scale is negative. This bug has been fixed in the editor.
* Prevent invalid entries in incrementally built broadphase if it was built non-incrementally previously.
### Security
Copy file name to clipboardExpand all lines: CHANGELOG.md
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,33 @@ uid: unity-physics-changelog
4
4
5
5
# Changelog
6
6
7
+
## [1.4.0-pre.4] - 2025-07-11
8
+
9
+
### Added
10
+
11
+
* New `TerrainCollider.Create` function variant that allows customizing the triangulation pattern of the created terrain collider's cells by flipping their inner diagonal edge, thus enabling users to align the physics collision representation with their visual terrain mesh.
12
+
* A newly introduced Detailed Static Mesh Collision feature enables enhanced collision detection precision for interactions with static meshes, effectively eliminating ghost collisions that can otherwise frequently occur in the presence of small mesh triangles or at high motion speeds. To enable the feature select the "Detailed Static Mesh Collision" option in the "Advanced" section of your custom `PhysicsShapeAuthoring` component, or, If you are using built-in `Collider` components, add the new `DetailedStaticMeshCollisionAuthoring` component alongside your collider. For runtime-generated colliders, please use the `EnableDetailedStaticMeshCollision` parameter in the physics material.
13
+
* Integrity checks for incremental broadphase. When integrity checks are enabled (see Project Settings -> Physics -> Unity Physics -> Enable Integrity Checks) the `PhysicsTemporalCoherenceInfo` component data of rigid body entities is validated against the internal state of the broadphase, to make sure the data is as expected. This allows detecting unexpected external modifications to this important bookkeeping data.
14
+
15
+
### Changed
16
+
17
+
* Parallelize jacobian updates for substepping without consideration of solver phases since there are no data dependencies
18
+
* Safer access to nodes in `BoundingVolumeHierarchy` of broadphase, ensuring there are no out-of-bounds accesses.
19
+
20
+
### Fixed
21
+
22
+
* Fixed a crash when scheduling an IBodyPairsJob and an IJacobiansJob in a situation without any body pairs or jacobians present in the simulation.
23
+
* Division by zero errors causing NaN values when a Capsule degenerates into a Sphere (occurs when Height = 2*Radius)
24
+
* ConvexHull connectivity for flat convex colliders
25
+
* Referenced prefabs in bakers with built-in joints incorrectly displayed the anchor position when the `Auto Configure Connected Anchor` flag was enabled.
26
+
* Correctly compute the expansion space for convex / composite collision queries, preventing missed collisions in certain cases.
27
+
* Pass the "Build Static Tree" flag to tree build job in single-threaded version of static tree update.
28
+
* A specific use case has been patched which applies only to Mac Silicon devices using editor version 2022.3 and when a negative scale is used in the transform of a BoxCollider: The transform calculation from localToWorld matrix to quaternion doesn't return the correct value due to differences in the calculation of rsqrt(x). This is exhibited as BoxGeometry orientations returning a strange quaternion value when the scale is negative. This bug has been fixed in the editor.
29
+
* Prevent invalid entries in incrementally built broadphase if it was built non-incrementally previously.
30
+
31
+
### Security
32
+
33
+
7
34
## [1.4.0-pre.3] - 2025-06-06
8
35
9
36
@@ -507,7 +534,7 @@ uid: unity-physics-changelog
507
534
508
535
### Upgrade guide
509
536
510
-
* The physics pipeline has been reworked. - `PhysicsSystemGroup` is introduced. It is a `ComponentSystemGroup` that covers all physics jobs. It consists of `PhysicsInitializeGroup`, `PhysicsSimulationGroup`, and `ExportPhysicsWorld`. `PhysicsSimulationGroup` further consists of `PhysicsCreateBodyPairsGroup`, `PhysicsCreateContactsGroup`, `PhysicsCreateJacobiansGroup`, `PhysicsSolveAndIntegrateGroup` which run in that order. See [documentation](xref:interacting-with-physics) for details. - `StepPhysicsWorld` and `EndFramePhysicsSystem` systems have been removed, `BuildPhysicsWorld` has been moved to `PhysicsInitializeGroup`: - If you had `Update(Before|After)StepPhysicsWorld`, replace it with: `[UpdateInGroup(typeof(PhysicsSystemGroup))][Update(After|Before)(typeof(PhysicsSimulationGroup))]`. - If you had `Update(Before|After)BuildPhysicsWorld`, replace it with: `[UpdateBefore(typeof(PhysicsSystemGroup))]` or `[UpdateInGroup(typeof(PhysicsSystemGroup))][UpdateAfter(typeof(PhysicsInitializeGroup))]` - If you had `Update(Before|After)ExportPhysicsWorld` replace it with: `[UpdateInGroup(typeof(PhysicsSystemGroup))][UpdateBefore(typeof(ExportPhysicsWorld))]` or `[UpdateAfter(typeof(PhysicsSystemGroup))]` - If you had `[Update(Before|After)EndFramePhysicsSystem]` replace it with: `[UpdateAfter(typeof(PhysicsSystemGroup))]` - If you had combination of those (e.g. `[UpdateAfter(typeof(BuildPhysicsWorld))][UpdateBefore(typeof(StepPhysicsWorld))`) take a look at the diagram in [documentation](xref:interacting-with-physics). - All new systems are unmanaged, which means that they are more efficient, and their `OnUpdate()` is Burst friendly. You shouldn't call `World.GetOrCreateSystem<AnyPhysicsSystem>()` as of this release and should be using singletons (see below).
537
+
* The physics pipeline has been reworked. - `PhysicsSystemGroup` is introduced. It is a `ComponentSystemGroup` that covers all physics jobs. It consists of `PhysicsInitializeGroup`, `PhysicsSimulationGroup`, and `ExportPhysicsWorld`. `PhysicsSimulationGroup` further consists of `PhysicsCreateBodyPairsGroup`, `PhysicsCreateContactsGroup`, `PhysicsCreateJacobiansGroup`, `PhysicsSolveAndIntegrateGroup` which run in that order. See [documentation](xref:interacting-with-physics) for details. - `StepPhysicsWorld` and `EndFramePhysicsSystem` systems have been removed, `BuildPhysicsWorld` has been moved to `PhysicsInitializeGroup`: - If you had `Update(Before|After)StepPhysicsWorld`, replace it with: `[UpdateInGroup(typeof(PhysicsSystemGroup))][Update(After|Before)(typeof(PhysicsSimulationGroup))]`. - If you had `Update(Before|After)BuildPhysicsWorld`, replace it with: `[UpdateBefore(typeof(PhysicsSystemGroup))]` or `[UpdateInGroup(typeof(PhysicsSystemGroup))][UpdateAfter(typeof(PhysicsInitializeGroup))]` - If you had `Update(Before|After)ExportPhysicsWorld` replace it with: `[UpdateInGroup(typeof(PhysicsSystemGroup))][UpdateBefore(typeof(ExportPhysicsWorld))]` or `[UpdateAfter(typeof(PhysicsSystemGroup))]` - If you had `[Update(Before|After)EndFramePhysicsSystem]` replace it with: `[UpdateAfter(typeof(PhysicsSystemGroup))]` - If you had combination of those (e.g. `[UpdateAfter(typeof(BuildPhysicsWorld))][UpdateBefore(typeof(StepPhysicsWorld))`) take a look at the diagram in [documentation](xref:interacting-with-physics). - All new systems are unmanaged, which means that they are more efficient, and their `OnUpdate()` is Burst friendly. You shouldn't call `World.GetOrCreateSystem<AnyPhysicsSystem>()` as of this release and should be using singletons (see below).
511
538
* Retrieval of `PhysicsWorld` is achieved differently. Previously, it was necessary to get it directly from `BuildPhysicsWorld` system. Now, `PhysicsWorld` is retrieved by calling (`SystemAPI|SystemBase|EntityQuery`).GetSingleton<PhysicsWorldSingleton>().PhysicsWorld in case read-only access is required, and by calling (`SystemAPI|SystemBase|EntityQuery`).GetSingletonRW<PhysicsWorldSingleton>().PhysicsWorld in case of a read-write access. It is still possible to get the world from `BuildPhysicsWorld`, but is not recommended, as it can cause race conditions. This is only affecting the `PhysicsWorld` managed by the engine. Users still can create and manage their own `PhysicsWorld`. Check out [documentation](xref:interacting-with-physics) for more information.
512
539
* Retrieval of `Simulation` is achieved differently. Previously, it was neccessary to get it directly from `StepPhysicsWorld` system. Now, `Simulation` is retrieved by calling (`SystemAPI|SystemBase|EntityQuery`).GetSingleton<SimulationSingleton>().AsSimulation() in case read-only access is required, and by calling (`SystemAPI|SystemBase|EntityQuery`).GetSingletonRW<SimulationSingleton>().AsSimulation() in case of read-write access. Check out [documentation](xref:interacting-with-physics) for more information.
513
540
* The dependencies between physics systems now get sorted automatically as long as `GetSingleton<>()` approach is used for retrieving `PhysicsWorld` and `Simulation`. There is no need to call `RegisterPhysicsSystems(ReadOnly|ReadWrite)`, `AddInputDependency()` or `AddInputDependencyToComplete()` and these functions were removed.
@@ -722,7 +749,7 @@ uid: unity-physics-changelog
722
749
* Added a `PhysicsMassOverride.SetVelocityToZero` field. If `PhysicsMassOverride.IsKinematic`, is a non-zero value, then a body's mass and inertia are made infinite, though it's motion will still be integrated. If `PhysicsMassOverride.SetVelocityToZero` is also a non-zero value, the kinematic body will ignore the values in the associated `PhysicsVelocity` component and no longer move.
723
750
724
751
* Run-Time Behavior
725
-
* If a body has infinite mass and/or inertia, then linear and/or angular damping will no longer be applied respectively.
752
+
* If a body has infinite mass and/or inertia, then linear and/or angular damping will no longer be applied respectively.
726
753
727
754
### Fixes
728
755
@@ -754,7 +781,7 @@ uid: unity-physics-changelog
754
781
* Removed `ModifiableJacobianHeader.HasColliderKeys`, `ModifiableJacobianHeader.ColliderKeyA` and `ModifiableJacobianHeader.ColliderKeyB` as they are not meant to be read by users, but to fill the data for collision events.
755
782
* Removed `SimulationCallbacks.Phase.PostSolveJacobians` as it doesn't have real use cases and it's causing inconsistencies between the two engines. Instead, users should schedule their jobs after `StepPhysicsWorld` and before `ExportPhysicsWorld` to achieve a similar effect.
756
783
* Added `ClampToMaxLength()` to `Unity.Physics.Math`, which reduces the length of specified `float3` vector to specified maxLength if it was bigger.
757
-
* `ColliderCastHit` and `DistanceHit` now have `QueryColliderKey` field. If the input of `ColliderCast` or `ColliderDistance` queries contains a non-convex collider, this field will contain the collider key of the input collider. Otherwise, its value will be `ColliderKey.Empty`.
784
+
*`ColliderCastHit` and `DistanceHit` now have `QueryColliderKey` field. If the input of `ColliderCast` or `ColliderDistance` queries contains a non-convex collider, this field will contain the collider key of the input collider. Otherwise, its value will be `ColliderKey.Empty`.
758
785
* Removed `AddInputDependency()` and `GetOutputDependency()` from all physics systems as dependencies are now handled in a different way (see below).
759
786
* Added `RegisterPhysicsRuntimeSystemReadOnly()` and `RegisterPhysicsRuntimeSystemReadWrite()` that are both extension methods for `SystemBase` and are used to declare interaction with the runtime physics data (stored in PhysicsWorld). One should call one of these in their system's `OnStartRunning()` (using `this.RegisterPhysicsRuntimeSystemReadOnly()` or `this.RegisterPhysicsRuntimeSystemReadWrite()`) to declare interaction with the physics data, which will translate to automatic data dependencies being included in the `SystemBase.Dependency` property of any system.
760
787
* Previously internal functions in `ColliderKey`, `ColliderKeyPath` and `ChildCollider` are now public to aid the traversal of a `Collider` hierarchy.
@@ -766,7 +793,7 @@ uid: unity-physics-changelog
766
793
* Added a `PhysicsRenderEntity` component data. This is primarily used for populating a `CompoundCollider.Child.Entity` field where there was no graphical representation on the same GameObject that has a `PhysicsShapeAuthoring` component.
767
794
768
795
* Run-Time Behavior
769
-
* `ColliderDistance` and `ColliderCast` queries now support non-convex input colliders (Compounds, Meshes and Terrains).
796
+
*`ColliderDistance` and `ColliderCast` queries now support non-convex input colliders (Compounds, Meshes and Terrains).
770
797
771
798
* Authoring/Conversion Behavior
772
799
@@ -838,7 +865,7 @@ uid: unity-physics-changelog
838
865
* Authoring/Conversion API
839
866
840
867
* Run-Time Behavior
841
-
* `ExportPhysicsWorld` system should now only get updated when there is at least one entity satisfying `BuildPhysicsWorld.DynamicEntityGroup` entity query.
868
+
*`ExportPhysicsWorld` system should now only get updated when there is at least one entity satisfying `BuildPhysicsWorld.DynamicEntityGroup` entity query.
842
869
843
870
* Authoring/Conversion Behavior
844
871
@@ -868,7 +895,7 @@ uid: unity-physics-changelog
868
895
* Added the `TerrainCollider.Filter` setter
869
896
* Removed the `CompoundCollider.Filter` setter as it was doing the wrong thing (composite collider filters should be the union of their children)
870
897
* Added `BuildPhysicsWorld.AddDependencyToComplete()` which takes a job dependency that the `BuildPhysicsWorld` system should complete immediately in its `OnUpdate()` call (before scheduling new jobs). The reason is that this system does reallocations in the `OnUpdate()` immediately (not in jobs), and any previous jobs that are being run before this system could rely on that data being reallocated. This way, these jobs can provide their dependency to `BuildPhysicsWorld` and make sure it will wait until they are finished before doing the reallocations.
871
-
* Added the option to provide a custom explosion filter in 'PhysicsVelocity.ApplyExplosionForce'.
898
+
* Added the option to provide a custom explosion filter in 'PhysicsVelocity.ApplyExplosionForce'.
Copy file name to clipboardExpand all lines: Documentation~/attract-body.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Interacting with rigid bodies can be done using scripts. For example to alter the velocity of a body, you can query for its `PhysicsVelocity` and set new values. Let's make an example that attracts all bodies to a single point.
4
4
5
-
First, we will create a `MonoBehaviour` script file called `TargetAuthoring.cs` (with two values, one float and one GameObject) and attach it to the Sphere GameObject. This will allow us to input data values from the inspector. Then, we need to add an `IComponentData` struct named `Target` and as well as a `Baker` called `TargetAuthoringBaker` and bridge the values from the `TargetAuthoring` with the `Target`.
5
+
First, we will create a `MonoBehaviour` script file called `TargetAuthoring.cs` (with two values, one float and one GameObject) and attach it to the Sphere GameObject. This will allow us to input data values from the inspector. Then, we need to add an `IComponentData` struct named `Target` and as well as a `Baker` called `TargetAuthoringBaker` and bridge the values from the `TargetAuthoring` with the `Target`.
6
6
7
7
```csharp
8
8
usingUnity.Entities;
@@ -37,7 +37,7 @@ public class TargetAuthoringBaker : Baker<TargetAuthoring>
37
37
38
38
Now, we need do something similar to be able run the logic inside the `ISystem`. Create another `MonoBehaviour` script file called `MovingBodyAuthoring.cs` but instead of authoring the same values than before, we will use a float for velocity magnitude.
39
39
40
-
Inside the OnUpdate within `ISystem`, let's use the new idiomatic `foreach()` to query for all the entities with `MovingBody`. Then we can run the command to calculate the relative distance between the `Target` position and the `MovingBody` entity. Finally, we compare if the distance is smaller than the MaxDistance value, if so the `PhysicsVelocity` will be altered and the entity will start moving towards the target position.
40
+
Inside the OnUpdate within `ISystem`, let's use the new idiomatic `foreach()` to query for all the entities with `MovingBody`. Then we can run the command to calculate the relative distance between the `Target` position and the `MovingBody` entity. Finally, we compare if the distance is smaller than the MaxDistance value, if so the `PhysicsVelocity` will be altered and the entity will start moving towards the target position.
Copy file name to clipboardExpand all lines: Documentation~/built-in-components.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Unity Physics supports the built-in Unity Engine Physics components for sub-scen
15
15
*[FixedJoint](xref:class-FixedJoint)
16
16
*[HingeJoint](xref:class-HingeJoint)
17
17
*[Ragdolls](xref:ragdoll-physics-section)
18
-
* See the [Unity Physics Samples](https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/PhysicsSamples) project for ragdoll demo scenes.
18
+
* See the [Unity Physics Samples](https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/PhysicsSamples) project for ragdoll demo scenes.
19
19
20
20
Alternatively, you can use the custom physics components for authoring your simulation.
21
21
Refer to the [Custom Physics Authoring](custom-samples-physics-components.md) section for more details.
Copy file name to clipboardExpand all lines: Documentation~/collision-queries.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,7 +171,7 @@ This section lists some simple examples for various queries. The examples for Ra
171
171
}
172
172
returnEntity.Null;
173
173
}
174
-
```
174
+
```
175
175
176
176
That will return the closest hit Entity along the desired ray. You can inspect the results of `RaycastHit` for more information such as hit position and normal etc.
Copy file name to clipboardExpand all lines: Documentation~/component-step.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# The Physics Step authoring component
1
+
# The Physics Step authoring component
2
2
3
3
To control Unity Physics settings, you need a `Physics Step` authoring component. As usual when working with **Entities**, a **SubScene** is necessary when adding the `Physics Step` authoring component. Only one instance of this component should be present in a scene as it will apply to the whole physics simulation.
0 commit comments