com.unity.physics 1.1.0-pre.3
Source docsNotes: processedReleased November 8, 2023
Unity Compatibility
Minimum Unity: 2022.3 (0f1)
Package Dependencies
- com.unity.burst (1.8.8)
- com.unity.collections (2.3.0-pre.3)
- com.unity.entities (1.1.0-pre.3)
- com.unity.mathematics (1.2.6)
- com.unity.modules.imgui (1.0.0)
- com.unity.modules.jsonserialize (1.0.0)
- com.unity.test-framework (1.3.8)
✨ Features
- The `Physics Debug Display` component can now display colliders of type `TerrainCollider`.
- The `Layer Overrides` properties specified in `Collider` and `Rigidbody` authoring components are now baked into the `CollisionFilter` of the resultant Unity Physics colliders. For each individual `Collider` authoring component, the layer overrides on its `Rigidbody` and the collider itself are combined and together form the `CollidesWith` mask in the `CollisionFilter` of the baked collider. The collider collides with layers which are included, and does not collide with layers which are excluded. Furthermore, exclusions have precedence over inclusions.
- `MassProperties.Scale` function allows uniformly scaling mass properties in a physically correct manner, assuming unit mass.
- `MassProperties.CreateSphere` function for creation of the mass properties of a sphere with the provided radius, assuming unit mass.
📈 Improvements
- Significantly improved performance of `Physics Debug Display` through a reduced need for thread synchronization via batching of debug display data.
- The `Physics Debug Display` now automatically resizes its debug draw data buffers dynamically to ensure all entities are drawn.
- Game objects with built-in or custom collider authoring components that have a purely uniform scale at edit-time, will now have the scale carried over into their `LocalTransform` component's `Scale` property during entity baking. Thus far, any scale, including a purely uniform scale, was baked into the Unity Physics collider geometry instead and the corresponding entity's `LocalTransform.Scale` property was set to 1 rather than to the desired uniform scale value. This is no longer the case, and users can now expect to find the uniform edit-time scale they assign to their game objects also in the resultant, baked entities during run-time, making run-time modifications of already uniformly scaled objects much more intuitive and less cumbersome.
- Rigid bodies baked from game objects which have any world-space scale or shear at edit-time can now be scaled at runtime using their `LocalTransform` component's `Scale` property. Previously, this was not possible. Runtime scaling using the `LocalTransform.Scale` property was only possible when the edit-time scale of the baked game object was identity, and no shear was present.
- `Entity` references in `CompoundCollider` children are no longer automatically set during baking since these references are not guaranteed to be valid in the `World` after baking. Only those entity references that appear in components and buffers, such as the `PhysicsColliderKeyEntityPair` buffer, are always guaranteed to be valid. Note that the `PhysicsColliderKeyEntityPair` buffer is still present on entities which contain a baked compound collider. Via collider keys, this buffer provides a mapping between the child colliders and the original entities that they were in at bake time.
🔧 Bug Fixes
- Prevent race condition between the systems that produce the debug draw data and the display system that renders the data. This allows the debug data to be fully produced before the display system attempts to render it.
- Fix draw of collider entities without `LocalToWorld` component when selecting `PostIntegration` in the Physics Debug Display.
- Avoid leftover debug draw when switching scenes and new scene has no `Physics Debug Display`.
- Mass properties debug display now correctly considers the rigid body scale, and correctly handles cases with unphysical inertia tensors.
- Custom mass properties specified using the `Override Default Mass Distribution` option in the custom `Physics Body Authoring` component now work correctly even if no collider is present.
- A rigid body's uniform scale value (`LocalTransform.Scale`) is now always considered correctly in the simulation. Previously, when the rigid body entity also contained a `PostTransformMatrix` component, its uniform scale was not applied to its collider and mass properties, leading to erroneous mass properties and missed collisions (if uniform scale > 1) or ghost collisions (if uniform scale < 1).
- Collider debug display now correctly displays colliders with uniform scale other than 1 in accordance with their `LocalTransform` component's `Scale` value.
- Collider debug display now correctly displays rigid body entities with `Parent` component.
