What's new in Unity Physics 1.0
This is a summary of the changes in Unity Physics version 1.0.
For a full list of changes, see the Changelog. For information on how to upgrade to version 1.0, see the Upgrade guide.
Added
- Motors: For all 4 motor types, added a new field for the maximum impulse that the motor constraint can exert.
- Licence warning pop-up: adding the
com.havok.physicspackage in your project without the Unity Pro, Enterprise or Unity Industrial Collection license will prevent you from simulating Havok Physics in the editor and builds. [CreateBefore(typeof(BroadphaseSystem))]forPhysicsSimulationPickerSystemwithinUnityPhysicsSimulationSystems.csscript file.- Reference to com.unity.render-pipelines.universal version 10.7
- New shaders in the sampler that are SRP batcher and universal render pipeline compliant.
- New struct -
Unity.Physics.Math.ScaledMTransform: Provides the same utility asUnity.Physics.Math.MTransformbut supports uniform scale. - Operator which converts a
float4into aUnity.Physics.Plane. PhysicsComponentExtensions.ApplyScale(in this PhysicsMass pm, in Scale scale)- an extension method which scales up thePhysicsMasscomponent.- Multiple extension methods have received a version which takes a
Scaleargument, you can see the full list at the Changelog. bool OverlapAabb(OverlapAabbInput input, ref NativeList<int> allHits)has been added to PhysicsWorld.SimulationSingletonIComponentData is added.PhysicsWorldSingletonIComponentData is added. It implementsICollidableand has access to the storedPhysicsWorldand its utility methods.NativeReference<int> HaveStaticBodiesChangedget property is added toBuildPhysicsWorld.- Multiple new system groups are introduced: like the
PhysicsSystemGroup, see the full list at the Changelog. - Impulse events to allow users to break joints.
- Supports the following types of motors: rotational, linear velocity, rotational, angular velocity.
CustomPhysicsSystemGroupandCustomPhysicsSystemGroupBasefor providing multiple worlds support.CustomPhysicsProxyDriverIComponentData, with it's authoring (CustomPhysicsProxyAuthoring) and a system (SyncCustomPhysicsProxySystem), which enable you to drive an entity from one world by an entity from another, using kinematic velocities.
Updated
- Naming path for Unity Physics Authoring components are now under
Components > Entities > Physics. - Use of the new idiomatic
foreachstatement inside of the physics package replacing the oldEntities.ForEachAPI. - All materials in the samples to be universal render pipeline compliant.
- Restored many Gizmo/Mesh methods from DisplayCollidersSystem.cs, but placed in a Utility file instead.
- Changed allocator label to
Allocator.Tempinternally when buildingCollisionWorldfromCollisionWorldProxy. - Physics Debug Display: Performance improvements when drawing colliders (faces, edges, AABBs), broadphase, mass properties and contacts.
- Physics Debug Display: Drawing collider faces for Mesh and Convex Hull types use different rendering methods.
- Physics Debug Display: The original Collider Edge drawing code that uses Gizmos has been moved to class 'DisplayGizmoColliderEdges' and to class 'AppendMeshColliders'.
- Using built-in resources for the reference mesh used by cube and icosahedron.
- Resources/ (used by Debug Draw) has been renamed DebugDisplayResources/ and now loads assets differently.
- Removed use of the obsolete AlwaysUpdateSystem attribute. The new RequireMatchingQueriesForUpdate attribute has been added where appropriate.
ColliderCastInputnow has a propertyQueryColliderScale. It defaults to1.0f, and represents the scale of the passed-in input collider.ColliderCastInputconstructor has changed to take in uniform scale of the query collider as the last parameter. It defaults to1.0f.- The following methods have a uniform scale argument added as the last argument (defaults to
1.0f), and their arguments are reordered. The old versions are deprecated, see the full list at Changelog. BuildPhysicsWorldis now astructinstead of aclass, and implementsISysteminstead ofSystemBase.ExportPhysicsWorldis now astructinstead of aclass, and implementsISysteminstead ofSystemBase.- Multiple
PhysicsWorldBuilder.signatures have changed, see Changelog. PhysicsWorldData.HaveStaticBodiesChangedis now aNativeReference<int>instead ofNativeArray<int>.PhysicsWorldData.PhysicsWorldComponentHandlesstruct is added. It contains component handles to data types needed to create aPhysicsWorld.PhysicsWorldDataalso has anUpdate(ref SystemState)method which just callsUpdate(ref SystemState)onPhysicsWorldComponentHandles.- Multiple
PhysicsWorldExporter.signatures have changed, see Changelog. - The Joint Constraints container changed from FixedList128 to a custom internal container. Users will get a FixedList512 returned when retrieving constraints.
- Replaced obsolete EntityQueryBuilder APIs with current ones.
ISystemimplementations with public data converted to using components for data access.
Removed
- Dependency on
com.unity.jobspackage has been removed. - Dependency on
com.unity.test-framework.performancepackage has been removed. - Removed
ICollider.CalculateAabb(RigidTransform transform). AllIColliderimplementations will still be able to callCalculateAabb(RigidTransform transform, float uniformScale = 1), exceptRigidBody,PhysicsWorldandCollisionWorld, where these methods are deprecated. - Removed
CollisionWorldProxy. UsePhysicsWorldSingletonto achieve the same functionality. - Simulation callback mechanism has been removed. Find removed APIs at Changelog.
- Removed
PhysicsWorldgetter fromBuildPhysicsWorld. It is still possible to get aPhysicsWorldreference throughBuildPhysicsWorld.PhysicsData.PhysicsWorldbut it isn't recommended since it can cause race conditions. - Removed
StepPhysicsWorldsystem. - Removed
EndFramePhysicsSystemsystem. - Removed
BuildPhysicsWorld.AddInputDependencyToComplete()from public API. - Removed
BuildPhysicsWorld.AddInputDependency()method. - Removed
BuildPhysicsWorld.GetOutputDependency()method. - Removed
ExportPhysicsWorld.AddInputDependency()method. - Removed
ExportPhysicsWorld.GetOutputDependency()method. - Removed
static class PhysicsRuntimeExtensions, as a consequence, some extension methods are removed as well, see Changelog. - Removed
PhysicsWorldExporter.SharedDatastruct. - Removed
PhysicsWorldExporter.ScheduleCollisionWorldProxy()method. - Removed
PhysicsWorldExporter.ScheduleCollisionWorldCopy()method. - Removed
PhysicsWorldExporter.CopyCollisionWorldImmediate()method. - Removed
PhysicsWorldStepperclass.