[0.4.1-preview] - 2020-07-28
Changes
- Run-Time API
- Added the following members:
FloatRange.MidAABB.ClosestPoint
- Changed the following members/types:
- All systems now inherit
SystemBaseinstead ofComponentSystem.
- All systems now inherit
- Added the following members:
Fixes
- When using Unity 2020.1.0b13 or newer, it is now possible to convert mesh colliders inside of sub-scenes when their input meshes do not have read/write enabled. Meshes converted at run-time must still have read/write enabled.
- Stopped emitting warning messages about physics material properties being upgraded when creating new objects from editor scripts.
- Fixed warnings from exceptions thrown in Bursted code paths when using Burst 1.4.0.
- Fixed issue with static layer not being rebuilt when order of entities in chunk changes.
- Fixed issue with invalid colliders with empty AABB breaking bounding volume hierarchy and making objects "disappear" from the world.
- Fixed an editor crash when maximum level of composite collider nesting is breached.
[0.4.0-preview.5] - 2020-06-18
Upgrade guide
RigidBodyqueries may no longer work, since they required inputs to be transformed to body space. As of this release, body queries require input in world space.- Core physics systems now expose
AddInputDependency()andGetOutputDependency()methods for user code to be able to plug in user systems between any of the core physics systems (BuildPhysicsWorld,StepPhysicsWorld,ExportPhysicsWorldandEndFramePhysicsSystem). - The serialization layout has changed for
PhysicsShapeAuthoringandPhysicsMaterialTemplate. Because data are upgraded before Prefab overrides are applied, you must manually re-apply any Prefab overrides that existed on scene objects, nested Prefabs, or Prefab variants for the migrated properties. It is recommended you use the data upgrade utility under the menu item Window -> DOTS -> Physics -> Upgrade Data.m_IsTriggerandm_RaisesCollisionEventshave been replaced withm_CollisionResponse.m_BelongsTohas been replaced withm_BelongsToCategoriesm_CollidesWithhas been replaced withm_CollidesWithCategoriesm_CustomTagshas been replaced withm_CustomMaterialTags
Changes
Dependencies
- Updated minimum Unity Editor version from
2019.3.0f1to2019.4.0f1 - Updated Burst from
1.3.0-preview.7to1.3.0 - Updated Collections from
0.7.1-preview.3to0.9.0-preview.6 - Updated Entities from
0.9.0-preview.6to0.11.1-preview.4 - Updated Jobs from
0.2.8-preview.3to0.2.10-preview.12 - Updated Performance Testing API from
1.3.3-previewto2.0.8-preview
- Updated minimum Unity Editor version from
Run-Time API
- Added the following new types:
BuildPhysicsWorld.CollisionWorldProxyGroupCollisionResponsePolicy(introduces a new value,None, which allows a shape to move and participate in queries, without generating a collision response or overlap events)CollisionWorldProxyto synchronizeCollisionWorldwith data flow graph node setsColliderCastNodeto perform queries in a data flow graph nodeForceModeto use with extension methods analogous to those used with classicRigidbodyJointComponentExtensionsfor use withPhysicsJointJointTypeto serve as a hint to code modifying joint limitsPhysicsExcludeto easily exclude bodies from physics temporarilyPhysicsMassOverrideto easily make dynamic bodies enter and exit a kinematic statePhysicsConstrainedBodyPairPhysicsJointCompanionto keep track of sets of joints used to stabilize complex joint configurationsRaycastNodeto perform queries in a data flow graph nodeSolver.StabilizationDataSolver.StabilizationHeuristicSettings
- Added the following members:
ComponentExtensions.ApplyExplosionForce()equivalent to classicRigidbody.ApplyExplosionForce()method.ComponentExtensions.GetImpulseFromForce()to mapForceModevariants to impulses.FloatRange.Sorted()to ensureMinis not larger thanMax.PhysicsStep.SolverStabilizationHeuristicSettingsto enable and configure solver stabilization heuristic. This can improve behavior in stacking scenarios, as well as overall stability of bodies and piles, but may result in behavior artifacts. It is off by default to avoid breaking existing behavior. Setting it to true enables the heuristic and its default parameters.PhysicsStep.SynchronizeCollisionWorldto enable rebuild of the dynamic bodies bounding volume hierarchy after the step. This enables precise query results before the nextBuildPhysicsWorldupdate call. Note thatBuildPhysicsWorldwill do this work on the following frame anyway, so only use this option when another system must know about the results of the simulation before the end of the frame (e.g., to destroy or create some other body that must be present in the following frame). In most cases, tolerating a frame of latency is easier to work with and is better for performance.PhysicsVelocity.CalculateVelocityToTarget()to move kinematic bodies to desired target locations without teleporting them.SurfaceConstraintInfo.IsMaxSlope- Implemented
ToString()on some typesColliderCastHitColliderCastInputColliderKeyRaycastHitRaycastInput
- Renamed the following members/type:
BodyAIndexandBodyBIndexare nowBodyIndexAandBodyIndexBacross the codebase for consistency.ComponentExtensions.GetAngularVelocity()andSetAngularVelocity()are nowGetAngularVelocityWorldSpace()andSetAngularVelocityWorldSpace(), respectively.ComponentExtensions.GetCenterOfMass()andSetCenterOfMass()are nowGetCenterOfMassWorldSpace()andSetCenterOfMassWorldSpace().JointFrameis nowBodyFrame
- Changed the following members/types:
- Replaced all usages of
NativeSlicewithNativeArray. - Replaced pair interfaces on events and modifiers (
CollisionEvent,TriggerEvent,ModifiableContactHeader,ModifiableBodyPairandModifiableJacobianHeader) with direct accessors:EntityPairis nowEntityAandEntityBBodyIndexPairis nowBodyAIndexandBodyBIndexColliderKeyPairis nowColliderKeyAandColliderKeyBCustomTagsPairis nowCustomTagsAandCustomTagsB
Material.MaterialFlagsis now internal. Access flags through individual properties (CollisionResponse,EnableMassFactorsandEnableSurfaceVelocity).Jointis now a fixed size.Joint.EnableCollisionis nowbyteinstead ofint.Joint.JointDatahas been deprecated. UseAFromJoint,BFromJoint,Constraints, andVersioninstead.
PhysicsJointis now mutable.PhysicsJoint.CreatePrismatic()factory does not take adistanceFromAxisparameter (in contrast toJointDatafactory)PhysicsJoint.CreateRagdoll()factory now takes perpendicular angular limits in the range (-pi/2, pi/2) instead of (0, pi) in oldJointDatafactory.
- Replaced all usages of
- Deprecated the following members/types:
EndFramePhysicsSystem.HandlesToWaitFor(useAddInputDependency()instead).FinalJobHandleon all core physics systems (BuildPhysicsWorld,StepPhysicsWorld,ExportPhysicsWorldandEndFramePhysicsSystem) (useGetOutputDependency()instead).JointDataMaterial.IsTrigger(useCollisionResponseinstead)Material.EnableCollisionEvents(useCollisionResponseinstead)PhysicsJoint.EntityA(now defined onPhysicsConstrainedBodyPair)PhysicsJoint.EntityB(now defined onPhysicsConstrainedBodyPair)PhysicsJoint.EnableCollision(now defined onPhysicsConstrainedBodyPair)PhysicsJoint.JointData(useBodyAFromJoint,BodyBFromJoint, andGetConstraints()/SetConstraints()instead).SimulationContext.Reset()passingPhysicsWorld(use signature passingSimulationStepInputinstead).
- Removed the following members/types:
CollisionFilter.IsValidCollisionWorld.ScheduleUpdateDynamicLayer()Constraintfactory signatures passingfloatvalues for ranges:Cone()Cylindrical()Planar()Twist()
ISimulation.ScheduleStepJobs()signature without callbacks and thread count hint (as well as all implementations)JointDatafactory signatures passingfloat3andquaternionpairs for joint frames, as well asConstraint[]:CreateFixed()CreateHinge()CreateLimitedHinge()CreatePrismatic()CreateRagdoll()
MassFactors.InvInertiaAndMassFactorAMassFactors.InvInertiaAndMassFactorBMotionData.GravityFactor(useMotionVelocity.GravityFactorinstead)MotionVelocity.InverseInertiaAndMassRigidBody.HasColliderSimplexSolver.Solve()signature passingPhysicsWorldSimulationStepInput.ThreadCountHint
- Added the following new types:
Authoring/Conversion API
- Added the following types
BeginJointConversionSystemEndJointConversionSystem(allows other conversion systems to find joint entities created during conversion)PhysicsMaterialTemplate.CollisionResponsePhysicsShapeAuthoring.CollisionResponsePhysicsShapeAuthoring.OverrideCollisionResponse
- Added the following members
PhysicsStepAuthoring.EnableSolverStabilizationHeuristicto enable solver stabilization heuristic with default settingsPhysicsStepAuthoring.SynchronizeCollisionWorld
- Deprecated the following members/types:
LegacyJointConversionSystemhas been marked obsolete and will be made internal in the future. UseBeginJointConversionSystemandEndJointConversionSystemto schedule system updates as needed.PhysicsMaterialTemplate.IsTrigger(useCollisionResponseproperty instead)PhysicsMaterialTemplate.RaisesCollisionEvents(useCollisionResponseproperty instead)PhysicsShapeAuthoring.IsTrigger(useCollisionResponseproperty instead)PhysicsShapeAuthoring.RaisesCollisionEvents(useCollisionResponseproperty instead)PhysicsShapeAuthoring.OverrideIsTrigger(useOverrideCollisionResponseproperty instead)PhysicsShapeAuthoring.OverrideRaisesCollisionEvents(useOverrideCollisionResponseproperty instead)
- Removed the following expired members:
LegacyColliderConversionSystem.ProduceMaterial()(removed without expiration; class is not intended to be sub-classed outside the package)PhysicsShapeAuthoring.GetCapsuleProperties()signature returningCapsuleGeometryPhysicsShapeAuthoring.SetCapsule()signature passingCapsuleGeometry
- Added the following types
Run-Time Behavior
BuildPhysicsWorld.JointEntityGroupnow requires both aPhysicsJointandPhysicsConstrainedBodyPaircomponent.Constraintfactory methods taking aFloatRangeswizzle the input value if needed to ensure thatMincannot be greater thanMax.RigidBodyqueries (Raycast(),ColliderCast(),PointDistance(), andColliderDistance()) now use world space input, and provide world space output, instead of using body space.
Authoring/Conversion Behavior
- It is now possible to create a compound collider by adding multiple
PhysicsShapeAuthoringcomponents to a single GameObject. - It is now possible to convert a GameObject with multiple
Jointcomponents on it.
- It is now possible to create a compound collider by adding multiple
Fixes
- When using Unity 2019.3.1f1 and newer, making changes to a
PhysicsMaterialTemplateasset or aMeshasset will now trigger a reimport of any sub-scenes containing shapes that reference it. IBodyPairsJobnow skips all joint pairs, when previously it didn't skip the joint pair if it was the first one in the list.- Fixed the issue of the
CompoundColliderwith no colliding children (all children are triggers) having invalid mass properties. - Fixed a potential race condition when
SynchronizeCollisionWorldwas set to true in theSimulationStepInput. CollisionFilterandAdvancedmaterial properties in the Inspector can now be expanded by clicking the label.
[0.3.2-preview] - 2020-04-16
Upgrade guide
- All
PhysicsShapeAuthoringcomponents that were newly added after version 0.3.0 were incorrectly initialized to have a bevel radius of 0. It is recommended that you audit recently authored content to assign reasonable non-zero values.
Changes
Dependencies
- Updated Collections from
0.5.2-preview.8to0.7.1-preview.3 - Updated Entities from
0.6.0-preview.24to0.9.0-preview.6 - Updated Jobs from
0.2.5-preview.20to0.2.8-preview.3
- Updated Collections from
Run-Time Behavior
- In order to test gameplay end to end determinism users should:
- Navigate to UnityPhysicsEndToEndDeterminismTest.cs (and HavokPhysicsEndToEndDeterminsmTest.cs if using HavokPhysics)
- Remove #if !UNITY_EDITOR guards around [TestFixture] and [UnityTest] attributes (alternatively, users can run the tests in standalone mode without the need to remove #ifs)
- Add scene that needs to be tested (File -> Build Settings -> Add Open Scenes)
- Make sure that synchronous burst is enabled
- Run the test in Test Runner
- In order to test gameplay end to end determinism users should:
Authoring/Conversion Behavior
- Compound conversion system is now deterministic between runs.
Fixes
- Volume of dynamic meshes is now being approximated with the volume of the mesh AABB, as opposed to previously being set to 0.
- Fixed regression causing newly added
PhysicsShapeAuthoringcomponents to initialize with a bevel radius of 0.
Known Issues
[0.3.1-preview] - 2020-03-19
Upgrade guide
- User implemented query collectors (
ICollector<T>) may no longer work. The reason is thatICollector<T>.TransformNewHits()was removed. To get the collectors working again, move all logic fromICollector<T>.TransformNewHits()toICollector<T>.AddHit(). All the information is now available inICollector<T>.AddHit(). Also,IQueryResult.Transform()was removed, and user implementations of it will not get called anywhere in the engine.
Changes
Dependencies
- Updated Burst from
1.3.0-preview.3to1.3.0-preview.7
- Updated Burst from
Run-Time API
- The following properties are added to
IQueryResultinterface:RigidBodyIndexColliderKeyEntity
ICollector.AddHit()now has all the information ready to perform custom logic, instead of waiting for TransformNewHits().- Removed
Transform()fromIQueryResultinterface and from all its implementations. - Removed both
TransformNewHits()methods fromICollectorinterface and from all its implementations. All the information is now ready inICollector.AddHit().
- The following properties are added to
Fixes
- Setting
Collider.Filternow increments the header version so that the simulation backends can recognise the change. - Asking for collision/trigger events in scenes with no dynamic bodies no longer throws errors.
- Updated to new version of Burst, which fixes a regression that caused
ConvexCollider.Create()to produce hulls with a very small bevel radius. - DOTS Run-time failures due to multiple inheritance of jobs have now been fixed.
- Changed
Math.IsNormalizedto use a larger tolerance when comparing float3 length.
[0.3.0-preview.1] - 2020-03-12
Upgrade guide
- In order to lead to more predictable behavior and allow for repositioning instantiated prefabs, static bodies are no longer un-parented during conversion. For best performance and guaranteed up-to-date values, it is still recommended that static bodies either be root-level entities, or that static shapes be set up as compounds. Dynamic and kinematic bodies are still un-parented. If your game code assumes static bodies are converted into world space, you may need to decompose
LocalToWorldusingMath.DecomposeRigidBodyTransform()rather than reading directly fromTranslationandRotation.
Changes
Dependencies
- Updated Entities from
0.3.0-preview.4to0.6.0-preview.24 - Added Burst
1.3.0-preview.3 - Added Collections
0.5.2-preview.8 - Added Jobs
0.2.5-preview.20 - Added Mathematics
1.1.0
- Updated Entities from
Run-Time API
- Added the following new types:
CollisionEvents(allows iterating through events directly using aforeachloop, rather than only viaICollisionEventsJob)DispatchPairSequencerIBodyPairsJobBaseICollisionEventsJobBaseIContactsJobBaseIJacobiansJobBaseITriggerEventsJobBaseIntegratorJointFrameMath.FloatRangeNarrowPhaseSimulationContextSimulationJobHandlesSolverTriggerEvents(allows iterating through events directly using aforeachloop, rather than only viaITriggerEventsJob)Velocity
- Added the following members:
CollisionWorld.DynamicBodiesCollisionWorld.NumDynamicBodiesCollisionWorld.NumStaticBodiesCollisionWorld.StaticBodiesCollisionWorld.BuildBroadphase()CollisionWorld.FindOverlaps()CollisionWorld.Reset()CollisionWorld.ScheduleBuildBroadphaseJobs()CollisionWorld.ScheduleFindOverlapsJobs()CollisionWorld.ScheduleUpdateDynamicTree()CollisionWorld.UpdateDynamicTree()DynamicsWorld.Reset()Math.DecomposeRigidBodyOrientation()Math.DecomposeRigidBodyTransform()MassFactors.InverseInertiaFactorAMassFactors.InverseInertiaFactorBMassFactors.InverseMassFactorAMassFactors.InverseMassFactorBMotionVelocity.InverseInertiaMotionVelocity.InverseMassSimulation.CollisionEventsSimulation.TriggerEventsSimulation.StepImmediate()
- Changed the following members/types:
CollisionWorldconstructor now requires specifying the number of dynamic and static bodies separatelyCollisionWorld.NumBodiesis now read-onlyDynamicsWorld.NumJointsis now read-onlyDynamicsWorld.NumMotionsis now read-onlyISimulation.ScheduleStepJobs()now requires callbacks and thread count hintITreeOverlapCollector.AddPairs()now has optional bool parameter to swap the bodiesJoint.JointDatais nowBlobAssetReference<Joint>instead ofJoint*RigidBody.Collideris nowBlobAssetReference<Collider>instead ofCollider*- The following types no longer implement
ICloneable. TheirClone()methods now return instances of their respective types rather thanobject:CollisionWorldDynamicsWorldPhysicsWorld
- The following types now implement
IEquatable<T>:Constraint
- Deprecated the following members:
CollisionFilter.IsValid(use its opposite,CollisionFilter.IsEmptyinstead)CollisionWorld.ScheduleUpdateDynamicLayer()(useScheduleUpdateDynamicTree()instead)Constraint.StiffSpring()(useConstraint.LimitedDistance()instead)Constraintfactory signatures passingfloatvalues for ranges (use new signatures takingFloatRangeinstead):Cone()Cylindrical()Planar()Twist()
JointData.Create()signature passingMTransformandConstraint[](use new signature that takesJointFrameandNativeArray<Constraint>instead)JointData.CreateStiffSpring()(useJointData.CreateLimitedDistance()instead)JointDatafactory signatures passingfloat3andquaternionpairs for joint frames (use new signatures takingJointFrameinstead):CreateFixed()CreateHinge()CreateLimitedHinge()CreatePrismatic()CreateRagdoll()
MassFactors.InvInertiaAndMassFactorA(useInverseInertiaFactorAand/orInverseMassFactorAinstead)MassFactors.InvInertiaAndMassFactorB(useInverseInertiaFactorBand/orInverseMassFactorBinstead)MotionVelocity.InverseInertiaAndMass(useInverseInertiaand/orInverseMassinstead)RigidBody.HasCollider(useCollider.IsCreatedinstead)SimplexSolver.Solve()signature passingPhysicsWorld(use new signature that does not require one, as it is not used)SimulationStepInput.ThreadCountHint(supply desired value directly toScheduleStepJobs())
- Removed the following expired members:
Broadphase.ScheduleBuildJobs()signature that does not specify gravityCollisionWorld.ScheduleUpdateDynamicLayer()signature that does not specify gravityJointData.NumConstraintsMeshCollider.Create()signatures takingNativeArray<int>PhysicsWorld.CollisionToleranceSimplexSolver.Solve()signature takingNativeArray<SurfaceConstraintInfo>SimulationStepInput.Callbacks(removed without expiration; pass callbacks toScheduleStepJobs())
- Added the following new types:
Authoring/Conversion API
- Added the following new types:
LegacyJointConversionSystemCapsuleGeometryAuthoring
- Added the following members:
PhysicsShapeAuthoring.GetCapsuleProperties()signature returningCapsuleGeometryAuthoringPhysicsShapeAuthoring.SetCapsule()signature passingCapsuleGeometryAuthoring
- Deprecated the following members:
PhysicsShapeAuthoring.GetCapsuleProperties()signature returningCapsuleGeometryPhysicsShapeAuthoring.SetCapsule()signature passingCapsuleGeometry
- Removed the following expired members/types:
BaseShapeConversionSystem<T>.ProduceColliderBlob()DisplayCollisionEventsSystem.DisplayCollisionEventsJobDisplayCollisionEventsSystem.FinishDisplayCollisionEventsJobDisplayCollisionEventsSystem.ScheduleCollisionEventsJob()DisplayContactsSystem.DisplayContactsJobDisplayContactsSystem.FinishDisplayContactsJobDisplayContactsSystem.ScheduleContactsJob()DisplayTriggerEventsSystem.DisplayTriggerEventsJobDisplayTriggerEventsSystem.FinishDisplayTriggerEventsJobDisplayTriggerEventsSystem.ScheduleTriggerEventsJob()PhysicsShapeAuthoring.GetMeshProperties()usingNativeList<int>. Use the signature takingNativeList<int3>instead
- Added the following new types:
Run-Time Behavior
- The data protocol for static rigid bodies has changed so that at least one of
Translation,Rotation, orLocalToWorldis required.- If a static body as a
Parent, then its transform is always decomposed from itsLocalToWorldcomponent (which may be the result of last frame's transformations if you have not manually updated it). - If there is no
Parent, then the body is assumed to be in world space and itsTranslationandRotationare read directly as before, if they exist; otherwise corresponding values are decomposed fromLocalToWorldif it exists. - In any case where a value must be decomposed from
LocalToWorldbut none exists, then a corresponding identity value is used (float3.zeroforTranslationandquaternion.identityforRotation).
- If a static body as a
- The following
CollisionWorldqueries no longer assert if the supplied collision filter is empty:CalculateDistance()CastCollider()CastRay()OverlapAabb()
Simulation.ScheduleStepJobs()can now schedule different types of simulation:- Providing a valid
threadCountHint(>0) as the last parameter will schedule a multi-threaded simulation - Not providing a
threadCountor providing an invalid value (<=0) will result in a simulation with a very small number of jobs being spawned (one per step phase) - Both simulation types offer the exact same customization options (callbacks) and outputs (events)
- Providing a valid
ISimulation.Step()is intended to allow you to step a simulation immediately in the calling code instead of spawning jobs- Unfortunately,
Unity.Physics.Simulationis currently not Burst-compatible, and therefore can't be wrapped in a Burst compiled job Simulation.StepImmediate()should be wrapped in a single Burst compiled job for lightweight stepping logic; however, it doesn't support callbacks- If callbacks are needed, one should implement the physics step using a set of function calls that represent different phases of the physics engine and add customization logic in between these calls; this should all be wrapped in a Burst compiled job; check
Simulation.StepImmediate()for the full list of functions that need to be called
- Unfortunately,
- Previously, if an Entity referenced by a
PhysicsJointcomponent was deleted,BuildPhysicsWorld.CreateJoints()would assert after failing to find a valid rigid body index. Now, if no valid body is found, theJoint.BodyIndexPairis marked as invalid instead and the simulation will ignore them. - Triggers no longer influence the center of mass or inertia of any compound colliders that they are part of.
- The data protocol for static rigid bodies has changed so that at least one of
Authoring/Conversion Behavior
- Implicitly static shapes (as well as explicitly static bodies) in a hierarchy are no longer un-parented during the conversion process. Dynamic and kinematic bodies still are.
- Bevel radius and convex hull simplification tolerance are no longer modified by an object's scale when it is converted.
- Improved performance of converting mesh colliders and convex hulls, particularly when they appear as multiple child instances in a compound collider.
- Improved visualization of primitive shapes in the SceneView.
PhysicsShapeAuthoringcomponents are now editable from within the SceneView.PhysicsShapeAuthoringprimitives are now oriented more correctly when non uniformly scaled.
Fixes
- Fixed regression where displaying a mesh or convex hull preview on a shape authoring component immediately after a domain reload would trigger an assert.
- Fixed possible bug where classic
MeshCollidercomponents might convert to the incorrect shape. - Frame Selected (F key in scene view) now properly focuses on the collision shape bounds.
ConvexCollider.Create()had been allocating too much memory forFaceVerticesIndexarray.MotionVelocity.CalculateExpansion()formula changed to reduce expansion of AABB due to rotation.ForceUniquecheckbox in the Inspector is no longer disabled for primitivePhysicsShapetypes.- Fixed a bug in scheduling resulting in race conditions during the solving phase.
PhysicsStepAuthoringandPhysicsDebugDisplayAuthoringno longer throw exceptions when embedded in a sub-scene.
Known Issues
- Due to a bug in the
TRSToLocalToParentsystem, static bodies in a hierarchy will always cause the broad phase to be rebuilt. This will be fixed in the next version of entities after 0.6.0. - Not all properties on classic joint components are converted yet:
- Converted properties include connected bodies, axes, collisions, anchors, and linear/angular limits.
- Motors, spring forces, mass scale, break limits, and projection settings are currently ignored.
- Swapping bodies on
ConfigurableJointis not yet supported. ConfigurableJointsetups with at least one free axis of angular motion are only stable if both other axes are locked (hinge), or both other axes are free (ball-and-socket).- Because solver behavior differs, some configurations also currently have a different feel from their classic counterparts.
- Modifying classic joints with Live Link enabled will currently leak memory.
- SceneView editing of
PhysicsShapeAuthoringcomponents currently only affects their size, but not their center offset.
[0.2.5-preview.1] - 2019-12-05
Fixes
- Fixed a bug that could cause compound colliders to not update with Live Link when moving around a mesh collider in the compound's hierarchy.
- Fixed possible incorrect instancing of colliders with different inputs
[0.2.5-preview] - 2019-12-04
Upgrade guide
- By default,
PhysicsCollidersthat share the same set of inputs and that originate from the same sub-scene should reference the same data at run-time. This change not only reduces memory pressure, but also speeds up conversion. If you were alteringPhysicsColliderdata at run-time, you need to enable theForceUniquesetting on the respectivePhysicsColliderAuthoringcomponent. This setting guarantees the object will always convert into a unique instance. - Any usages of
BlockStreamshould be replaced with theNativeStreamtype from the com.unity.collections package.
Changes
Run-Time API
- Removed
BlockStreamand migrated all usages toNativeSteam. - Access to
JointData.Constraintshas changed to an indexer. This means that to change the values of aConstraint, a copy should be made first. E.g.,c# var c = JointData.Constraints[index]; c.Min = 0; JointData.Constraints[index] = c; - Added
maxVelocityparameter toSimplexSolver.Solve()to clamp the solving results to the maximum value. - Added
SurfaceConstraintInfo.IsTooSteepto indicate that a particular surface constraint has a slope bigger than the slope character controller supports. MeshCollider.Create()now takes grouped triangle indices (NativeArray) instead of a flat list of indices (NativeArray ) as input. - Removed the following expired members/types:
BoxCollider.ConvexRadius(renamed toBevelRadius)CyllinderCollider.ConvexRadius(renamed toBevelRadius)- Collider factory methods passing nullable types and numeric primitives:
BoxCollider.Create()CyllinderCollider.Create()CapsuleCollider.Create()ConvexCollider.Create()MeshCollider.Create()PolygonCollider.CreateQuad()PolygonCollider.CreateTriangle()SphereCollider.Create()TerrainCollider.Create()
ComponentExtensionsmembers passing Entity (use components or variants passing component data instead):ApplyAngularImpulse()ApplyImpulse()ApplyLinearImpulse()GetAngularVelocity()GetCenterOfMass()GetCollisionFilter()GetEffectiveMass()GetLinearVelocity()GetMass()GetPosition()GetRotation()GetVelocities()SetAngularVelocity()SetLinearVelocity()SetVelocities()
CustomDataPairISimulation.ScheduleStepJobs()JacobianFlags.EnableEnableMaxImpulseMaterialFlags.EnableMaxImpulseModifiableContactHeader.BodyCustomDatasModifiableJacobianHeader.HasMaxImpulseModifiableJacobianHeader.MaxImpulseModifiableContactJacobian.CoefficientOfRestitutionModifiableContactJacobian.FrictionEffectiveMassOffDiagPhysicsCustomDataSimplexSolver.c_SimplexSolverEpsilonSimplexSolver.Solve()withoutminDeltaTimeparameter
- Removed
Authoring/Conversion API
- Added
PhysicsShapeAuthoring.ForceUnique. - Added the following conversion systems:
BeginColliderConversionSystemBuildCompoundCollidersConversionSystemEndColliderConversionSystem
PhysicsShapeAuthoring.GetMeshProperties()now populates aNativeList<int3>for indices, instead of aNativeList<int>.- The following public members have been made protected:
DisplayCollisionEventsSystem.FinishDisplayCollisionEventsJobDisplayTriggerEventsSystem.FinishDisplayTriggerEventsJob
- Removed the following expired members/types:
BaseShapeConversionSystem<T>.GetCustomFlags()DisplayCollidersSystem.DrawComponentDisplayCollidersSystem.DrawComponent.DisplayResultDisplayContactsJobDisplayJointsJobFinishDisplayContactsJobPhysicsShapeAuthoringmembers:SetConvexHull()passing only a meshGetMesh()replaced withGetMeshPropertiesConvexRadiusreplaced withBevelRadiusGetBoxProperties()returningvoidSetBox()passing a box center, size and orientation. PassBoxGeometryinstead.GetCapsuleProperties()returningvoidSetCapsule()passing a capsule center, height, radius and orientation. PassCapsuleGeometryinstead.GetCylinderProperties()returningvoidSetCylinder()passing a cylinder center, height, radius and orientation. PassCylinderGeometryinstead.GetSphereProperties()returningvoidSetSphere()passing a sphere center, radius and orientation. PassSphereGeometryinstead.
- The following components have been removed:
PhysicsBody(renamed toPhysicsBodyAuthoring)PhysicsShape(renamed toPhysicsShapeAuthoring)PhysicsStep(renamed toPhysicsStepAuthoring)PhysicsDebugDisplay(renamed toPhysicsDebugDisplayAuthoring)
- Added
Run-Time Behavior
CompoundCollider.Create()is now compatible with Burst.CompoundCollider.Create()now correctly shares memory among repeated instances in the list of children.
Authoring/Conversion Behavior
- If mesh and convex
PhysicsShapeAuthoringcomponents have not explicitly opted in toForceUnique, they may share the samePhysicsColliderdata at run-time, if their inputs are the same. - Classic
MeshColliderinstances with the same inputs will always share the same data at run-time when converted in a sub-scene. - Further improved performance of collider conversion for all types.
- If mesh and convex
Fixes
JointData.Versionwas not being incremented with changes to its properties.- Fixed the issue of uninitialized array when scheduling collision event jobs with no dynamic bodies in the scene.
- Fixed the issue of
CollisionEvent.CalculateDetails()reporting 0 contact points in some cases. - Fixed the issue of joints with enabled collisions being solved after contacts for the same body pair.
- Fixed exception and leak caused by trying to display a convex hull preview for a physics shape with no render mesh assigned.
- Fixed bug causing incremental changes to a compound collider to accumulate ghost colliders when using Live Link.
- Fixed an issue where kinematic (i.e. infinite mass dynamic) bodies did not write to the collision event stream correctly.
Known Issues
- Compound collider mass properties are not correctly updated while editing using Live Link.
[0.2.4-preview] - 2019-09-19
Changes
- Updated dependency on
com.unity.entitiesto version0.1.1-preview. If you need to stay on entities version0.0.12-preview.33then you can use the previous version of this package,0.2.3-preview, which is feature equivalent:
[0.2.3-preview] - 2019-09-19
Upgrade guide
- Implicitly static shapes (i.e. those without a
PhysicsBodyAuthoringorRigidbody) in a hierarchy under a GameObject withStaticOptimizeEntityare now converted into a single compoundPhysicsCollideron the entity with theStatictag. If your queries or contact events need to know about data associated with the entities from which these leaf shapes were created, you need to explicitly addPhysicsBodyAuthoringcomponents with static motion type, in order to prevent them from becoming part of the compound.
Changes
Run-Time API
- Deprecated
Broadphase.ScheduleBuildJobs()and provided a new implementation that takes gravity as input. - Deprecated
CollisionWorld.ScheduleUpdateDynamicLayer()and provided a new implementation that takes gravity as input. - Deprecated
PhysicsWorld.CollisionToleranceand moved it toCollisionWorld. - Deprecated
ManifoldQueries.BodyBody()and provided a new implementation that takes two bodies and two velocities. - Added
CollisionEvent.CalculateDetails()which provides extra information about the collision event:- Estimated impulse
- Estimated impact position
- Array of contact point positions
- Removed
CollisionEvent.AccumulatedImpulsesand providedCollisionEvent.CalculateDetails()which gives a more reliable impulse value.
- Deprecated
Authoring/Conversion API
- Removed the following expired ScriptableObject:
CustomFlagNames
- Removed the following expired members:
PhysicsShapeAuthoring.GetBelongsTo()PhysicsShapeAuthoring.SetBelongsTo()PhysicsShapeAuthoring.GetCollidesWith()PhysicsShapeAuthoring.SetCollidesWith()PhysicsShapeAuthoring.OverrideCustomFlagsPhysicsShapeAuthoring.CustomFlagsPhysicsShapeAuthoring.GetCustomFlag()PhysicsShapeAuthoring.SetCustomFlag()PhysicsMaterialTemplate.GetBelongsTo()PhysicsMaterialTemplate.SetBelongsTo()PhysicsMaterialTemplate.GetCollidesWith()PhysicsMaterialTemplate.SetCollidesWith()PhysicsMaterialTemplate.CustomFlagsPhysicsMaterialTemplate.GetCustomFlag()PhysicsMaterialTemplate.SetCustomFlag()
- Removed the following expired ScriptableObject:
Run-Time Behavior
- Gravity is now applied at the beginning of the step, as opposed to previously being applied at the end during integration.
Authoring/Conversion Behavior
- Implicitly static shapes in a hierarchy under a GameObject with
StaticOptimizeEntityare now converted into a single compoundPhysicsCollider.
- Implicitly static shapes in a hierarchy under a GameObject with
Fixes
- Fixed issues preventing compatibility with DOTS Runtime.
- Fixed occasional tunneling of boxes through other boxes and mesh triangles.
- Fixed incorrect AABB sweep direction during collisions with composite colliders, potentially allowing tunneling.
- Fixed obsolete
MeshCollider.Create()creating an empty mesh. - Fixed obsolete
ConvexCollider.Create()resulting in infinite recursion. - Fixed simplex solver bug causing too high output velocities in 3D solve case.
- Fixed bug causing custom meshes to be ignored on convex shapes when the shape's transform was bound to a skinned mesh.
- Fixed Burst incompatibilities in the following types:
BoxGeometryCapsuleGeometryCollisionFilterConvexHullGenerationParametersCylinderGeometryMaterialSphereGeometry
- Improved performance of
MeshConnectivityBuilder.WeldVertices(). - Fixed a potential assert when joints are created with a static and dynamic body (in that order).
Known Issues
[0.2.2-preview] - 2019-09-06
Fixes
- Added internal API extensions to work around an API updater issue with Unity 2019.1 to provide a better upgrading experience.
[0.2.1-preview] - 2019-09-06
Upgrade guide
- A few changes have been made to convex hulls that require double checking convex
PhysicsShapeAuthoringcomponents:- Default parameters for generating convex hulls have been tweaked, which could result in minor differences.
- Bevel radius now applies a shrink to the shape rather than an expansion (as with primitive shape types).
- Mesh
PhysicsShapeAuthoringobjects with no custom mesh assigned now include points from enabled mesh renderers on their children (like convex shapes). Double check any mesh shapes in your projects. - Due to a bug in version 0.2.0, any box colliders added to uniformly scaled objects had their scale baked into the box size parameter when initially added and/or when fit to render geometry. Double check box colliders on any uniformly scaled objects and update them as needed (usually by just re-fitting them to the render geometry).
- The serialization layout of
PhysicsShapeAuthoringhas changed. Values previously saved in them_ConvexRadiusfield will be migrated tom_ConvexHullGenerationParameters.m_BevelRadius, and am_ConvexRadius_Deprecatedfield will then store a negative value to indicate the old data have been migrated. Because this happens automatically when objects are deserialized, prefab instances may mark this field dirty even if the prefab has already been migrated. Double check prefab overrides for Bevel Radius on your prefab instances.
Changes
- Run-Time API
- Added the following new members:
BodyIndexPair.IsValidMath.Dotxyz1()using doublePlane.Projection()Plane.SignedDistanceToPoint()
- Added the following structs:
BoxGeometryCapsuleGeometryCylinderGeometrySphereGeometryConvexHullGenerationParameters
Constraintnow implementsIEquatable<Constraint>to avoid boxing allocations.- All previous
SphereCollider,CapsuleCollider,BoxColliderandCylinderColliderproperties are now read only. A newGeometryproperty allows reading or writing all the properties at once. BoxCollider.Create()now usesBoxGeometry. The signature passing nullable types has been deprecated.CapsuleCollider.Create()now usesCapsuleGeometry. The signature passing nullable types has been deprecated.ConvexCollider.Create()now usesConvexHullGenerationParameters. The signature passing nullable types has been deprecated.CylinderCollider.Create()now usesCylinderGeometry. The signature passing nullable types has been deprecated.MeshCollider.Create()now uses native containers. The signature using managed containers has been deprecated.PolygonCollider.CreateQuad()signature passing nullable types has been deprecated.PolygonCollider.CreateTriangle()signature passing nullable types has been deprecated.SphereCollider.Create()now usesSphereGeometry. The signature passing nullable types has been deprecated.TerrainCollider.Create()signature passing pointer and nullable types has been deprecated.SimplexSolver.Solve()taking therespectMinDeltaTimehas been deprecated. Use the newSimplexSolver.Solve()method that takesminDeltaTimeinstead.- Renamed
BoxCollider.ConvexRadiustoBevelRadius. - Renamed
CylinderCollider.ConvexRadiustoBevelRadius. - Deprecated
SimplexSolver.c_SimplexSolverEpsilon. - Deprecated the following methods in
ComponentExtensionstaking anEntityas the first argument.GetCollisionFilter()GetMass()GetEffectiveMass()GetCenterOfMass()GetPosition()GetRotation()GetVelocities()SetVelocities()GetLinearVelocity()SetLinearVelocity()GetAngularVelocity()SetAngularVelocity()ApplyImpulse()ApplyLinearImpulse()ApplyAngularImpulse()
- Removed the following expired members:
ColliderCastInput.DirectionColliderCastInput.PositionRay(float3, float3)Ray.DirectionRay.ReciprocalDirectionRaycastInput.DirectionRaycastInput.Position
- Added the following new members:
- Authoring/Conversion API
- Renamed
PhysicsBodytoPhysicsBodyAuthoring. - Renamed
PhysicsShapetoPhysicsShapeAuthoring. PhysicsShapeAuthoring.BevelRadiusnow returns the serialized bevel radius data in all cases, instead of returning the shape radius when the type was either sphere or capsule, or a value of 0 for meshes. Its setter now only clamps the value if the shape type is box or cylinder.PhysicsShapeAuthoring.GetBoxProperties()now returnsBoxGeometry. The signature containing out parameters has been deprecated.PhysicsShapeAuthoring.SetBox()now usesBoxGeometry. The signature passing individual parameters has been deprecated.PhysicsShapeAuthoring.GetCapsuleProperties()now returnsCapsuleGeometry. The signature containing out parameters has been deprecated.PhysicsShapeAuthoring.SetCapsule()now usesCapsuleGeometry. The signature passing individual parameters has been deprecated.PhysicsShapeAuthoring.GetCylinderGeometry()now returnsCylinderGeometry. The signature containing out parameters has been deprecated.PhysicsShapeAuthoring.SetCylinder()now usesCylinderGeometry. The signature passing individual parameters has been deprecated.PhysicsShapeAuthoring.GetSphereProperties()now returnsSphereGeometry. The signature containing out parameters has been deprecated.PhysicsShapeAuthoring.SetSphere()now usesSphereGeometry. The signature passing individual parameters has been deprecated.PhysicsShapeAuthoring.SetConvexHull()now usesConvexHullGenerationParameters. The old signature has been deprecated.PhysicsShapeAuthoring.ConvexRadiushas been deprecated. Instead useBevelRadiusvalues returned by geometry structs.PhysicsShapeAuthoring.GetConvexHullProperties()now returns points fromSkinnedMeshRenderercomponents that are bound to the shape's transform, or to the transforms of its children that are not children of some other shape, when no custom mesh has been assigned.- Added
PhysicsShapeAuthoring.SetConvexHull()signature specifying minimum skinned vertex weight for inclusion. - Added
PhysicsShapeAuthoring.ConvexHullGenerationParametersproperty. PhysicsShapeAuthoring.GetMesh()has been deprecated.- Added
PhysicsShapeAuthoring.GetMeshProperties(). When no custom mesh has been assigned, this will return mesh data from all render geometry in the shape's hierarchy, that are not children of some other shape. PhysicsShapeAuthoring.FitToEnabledRenderMeshes()now takes an optional parameter for specifying minimum skinned vertex weight for inclusion.- Removed the
OutputStreamfield from various deprecated debug drawing jobs. These will be redesigned in a future release, and you are advised to not try to extend them yet. - Removed the following expired members:
PhysicsShapeAuthoring.FitToGeometry().PhysicsShapeAuthoring.GetCapsuleProperties()returning raw points.PhysicsShapeAuthoring.GetPlaneProperties()returning raw points.FirstPassLegacyRigidbodyConversionSystem.FirstPassPhysicsBodyConversionSystem.SecondPassLegacyRigidbodyConversionSystem.SecondPassPhysicsBodyConversionSystem.
- Renamed
- Run-Time Behavior
BoxCollider.Create()is now compatible with Burst.CapsuleCollider.Create()is now compatible with Burst.ConvexCollider.Create()is now compatible with Burst.CylinderCollider.Create()is now compatible with Burst.MeshCollider.Create()is now compatible with Burst.SphereCollider.Create()is now compatible with Burst.TerrainCollider.Create()is now compatible with Burst.
- Authoring/Conversion Behavior
- Converting mesh and convex shapes is now several orders of magnitude faster.
- Convex meshes are more accurate and less prone to jitter.
PhysicsShapeAuthoringcomponents set to convex now display a wire frame preview at edit time.PhysicsShapeAuthoringcomponents set to cylinder can now specify how many sides the generated hull should have.- Inspector controls for physics categories, custom material tags, and custom body tags now have a final option to select and edit the corresponding naming asset.
Fixes
- Body hierarchies with multiple shape types (e.g., classic collider types and
PhysicsShapeAuthoring) now produce a single flatCompoundCollidertree, instead of a tree with severalCompoundColliderleaves. - Fixed issues causing dynamic objects to tunnel through thin static objects (most likely meshes)
- Fixed incorrect behavior of Constraint.Twist() with limitedAxis != 0
- Fixed regression introduced in 0.2.0 causing box shapes on uniformly scaled objects to always convert into a box with size 1 on all sides.
- Fixed exception when calling
Dispose()on an uninitializedCollisionWorld.
Known Issues
- Wire frame previews for convex
PhysicsShapeAuthoringcomponents can take a while to generate. - Wire frame previews for convex
PhysicsShapeAuthoringcomponents do not currently illustrate effects of bevel radius in the same way as primitives. - The first time you convert convex or mesh shapes in the Editor after a domain reload, you will notice a delay while the conversion jobs are Burst compiled. all subsequent conversions should be significantly faster until the next domain reload.
- Updated dependency on
com.unity.burstto version1.1.2.
[0.2.0-preview] - 2019-07-18
Upgrade guide
- If you created per-body custom data using
PhysicsShape.CustomFlagsthen you should instead do it usingPhysicsBody.CustomTags. - Some public API points were removed, either because they were not intended to be public or because they introduce other problems (see Changes below).
- Some of these API points may later be reintroduced on a case-by-case basis to enable customization for advanced use cases. Please provide feedback on the forums if these removals have affected current use cases so we can prioritize them.
- Some public API points were replaced with another one in a way that cannot be handled by the script updater, so they must be manually fixed in your own code (see Changes below).
- All public types in test assemblies were never intended to be public and have been made internal.
- Some properties on
PhysicsMaterialTemplateandPhysicsShapenow returnPhysicsCategoryTagsinstead ofint. Use itsValueproperty if you need to get/set a rawintvalue (see Changes below).
Changes
- Run-Time API
- Added first draft of a new
TerrainColliderstruct. Terrain geometry is defined by a height field. It requires less memory than an equivalent mesh and is faster to query. It also offers a fast, low-quality option for collision detection.- Added
ColliderType.Terrain. - Added
CollisionType.Terrain. - Added
DistanceQueries.ConvexTerrain<T>(). - Added
DistanceQueries.PointTerrain<T>().
- Added
- Shapes and bodies how have their own separate custom data.
- Added
Material.CustomTags(for shapes). - Replaced
PhysicsCustomDatawithPhysicsCustomTags(for bodies). - Replaced
ContactHeader.BodyCustomDataswithContactHeader.BodyCustomTags. - Replaced
CustomDataPairwithCustomTagsPair. - Replaced
RigidBody.CustomDatawithRigidBody.CustomTags.
- Added
- Removed coefficient of restitution concept from Jacobians. All restitution calculations are approximated and applied before the solve, so restitution changes at this point in the simulation have no effect.
ModifiableContactJacobian.CoefficientOfRestitutionis now obsolete.
ModifiableContactJacobian.FrictionEffectiveMassOffDiagis now obsolete. It was not possible to make any meaningful changes to it without fully understanding friction solving internals.- Removed max impulse concept from Jacobians. Solver design implies impulses are pretty unpredictable, making it difficult to choose maximum impulse value in practice.
JacobianFlags.EnableMaxImpulseis now obsolete.- Underlying values of
JacobianFlagshave been changed. - Added
JacobianFlags.UserFlag2.
- Underlying values of
Material.EnableMaxImpulseis now obsolete.MaterialFlags.EnableMaxImpulseis now obsolete.ModifiableJacobianHeader.HasMaxImpulseis now obsolete.ModifiableJacobianHeader.MaxImpulseis now obsolete.
- Removed the following members:
CollisionFilter.CategoryBitsCollisionFilter.MaskBits
- Removed the following types from public API and made them internal:
AngularLimit1DJacobianAngularLimit2DJacobianAngularLimit3DJacobianBaseContactJacobianBoundingVolumeHierarchy.BuildBranchesJobBoundingVolumeHierarchy.BuildFirstNLevelsJobBoundingVolumeHierarchy.FinalizeTreeJobBroadphaseColliderCastQueriesCollisionEventCollisionEventsContactHeaderContactJacobianConvexConvexDistanceQueriesConvexHullConvexHullBuilderConvexHullBuilderExtensionsDistanceQueriesElementPool<T>(Unity.Collections)IntegratorIPoolElement(Unity.Collections)JacobianHeaderJacobianIteratorJacobianUtilitiesLinearLimitJacobianManifoldQueriesMeshMotionExpansionNarrowPhaseOverlapQueriesQueryWrappersRaycastQueriesSchedulerSimulation.ContextSolverStaticLayerChangeInfoTriggerEventTriggerEventsTriggerJacobian
- Removed the following members from public API and made them internal:
- Aabb.CreateFromPoints(float3x4)
BoundingVolumeHierarchy.BuildBranch()BoundingVolumeHierarchy.BuildCombinedCollisionFilter()BoundingVolumeHierarchy.BuildFirstNLevels()BoundingVolumeHierarchy.CheckIntegrity()- All explicit
ChildColliderconstructors ColliderKeyPath(ColliderKey, uint)ColliderKeyPath.EmptyColliderKeyPath.GetLeafKey()ColliderKeyPath.PopChildKey()ColliderKeyPath.PushChildKey()CollisionWorld.BroadphaseCompoundCollider.BoundingVolumeHierarchyConstraint.ConstrainedAxis1DConstraint.DimensionConstraint.FreeAxis2DConvexCollider.ConvexHullMeshCollider.MeshMotionVelocity.CalculateExpansion()SimulationCallbacks.Any()SimulationCallbacks.Execute()
ChildCollider.TransformFromChildis now a readonly property instead of a field.- Removed
BuildPhysicsWorld.m_StaticLayerChangeInfo. - Added
FourTranposedAabbs.DistanceFromPointSquared()signatures passing scale parameter. - Changed
ISimulationinterface (i.e.Simulationclass).- Added
ISimulation.FinalJobJandle. - Added
ISimulation.FinalSimulationJobJandle. - Added simpler
ISimulation.ScheduleStepJobs()signature and marked previous one obsolete.
- Added
- Added
RigidBody.HasCollider. SimplexSolver.Solve()now takes an optional bool to specify whether it should respect minimum delta time.SurfaceVelocity.ExtraFrictionDvhas been removed and replaced with more usableLinearVelocityandAngularVelocitymembers.
- Added first draft of a new
- Authoring/Conversion API
- Added
CustomBodyTagNames. - Renamed
CustomMaterialTagNames.FlagNamestoCustomMaterialTagNames.TagNames. - Renamed
CustomFlagNamestoCustomPhysicsMaterialTagNames. - Renamed
CustomPhysicsMaterialTagNames.FlagNamestoCustomPhysicsMaterialTagNames.TagNames. - Added
PhysicsCategoryTags,CustomBodyTags, andCustomMaterialTagsauthoring structs. - The following properties now return
PhysicsCategoryTagsinstead ofint:PhysicsMaterialTemplate.BelongsToPhysicsMaterialTemplate.CollidesWithPhysicsShape.BelongsToPhysicsShape.CollidesWith
- The following members on
PhysicsMaterialTemplateare now obsolete:GetBelongsTo()SetBelongsTo()GetCollidesWith()SetCollidesWith()
- The following members on
PhysicsShapeare now obsolete:GetBelongsTo()SetBelongsTo()GetCollidesWith()SetCollidesWith()
- Added
PhysicsMaterialTemplate.CustomTags.CustomFlags,GetCustomFlag()andSetCustomFlag()are now obsolete.
- Added
PhysicsShape.CustomTags.CustomFlags,GetCustomFlag()andSetCustomFlag()are now obsolete.
- Added
PhysicsBody.CustomTags. - Renamed
PhysicsShape.OverrideCustomFlagstoPhysicsShape.OverrideCustomTags. - Renamed
PhysicsShape.CustomFlagstoPhysicsShape.CustomTags. - Renamed
PhysicsShape.GetCustomFlag()toPhysicsShape.GetCustomTag(). - Renamed
PhysicsShape.SetCustomFlag()toPhysicsShape.SetCustomTag(). - Overload of
PhysicsShape.GetCapsuleProperties()is now obsolete. - Overload of
PhysicsShape.GetPlaneProperties()is now obsolete. - Removed
PhysicsBody.m_OverrideDefaultMassDistribution(backing field never intended to be public). PhysicsShape.GetBoxProperties()now returns underlying serialized data instead of reorienting/resizing when aligned to local axes.BaseShapeConversionSystem.GetCustomFlags()is now obsolete.- Parameterless constructors have been made private for the following types because they should not be used (use instead ScriptableObjectCreateInstance
() or GameObject.AddComponent () as applicable): CustomPhysicsMaterialTagNamesPhysicsCategoryNamesPhysicsMaterialTemplatePhysicsBodyPhysicsShape
- The following types have been made sealed:
LegacyBoxColliderConversionSystemLegacyCapsuleColliderConversionSystemLegacySphereColliderConversionSystemLegacyMeshColliderConversionSystemLegacyRigidbodyConversionSystemPhysicsBodyConversionSystemPhysicsShapeConversionSystem
DisplayContactsJobhas been deprecated in favor of protectedDisplayContactsSystem.DisplayContactsJob.FinishDisplayContactsJobhas been deprecated in favor of protectedDisplayContactsSystem.FinishDisplayContactsJob.DisplayJointsJobhas been deprecated in favor of protectedDisplayJointsSystem.DisplayJointsJob.FinishDisplayTriggerEventsJobhas been deprecated in favor of protectedDisplayTriggerEventsSystem.FinishDisplayTriggerEventsJob.- The following types have been deprecated and will be made internal in a future release:
DisplayBodyColliders.DrawComponentDisplayCollisionEventsSystem.FinishDisplayCollisionEventsJob
- Added
- Run-Time Behavior
- Collision events between infinite mass bodies (kinematic-kinematic and kinematic-static) are now raised. The reported impulse will be 0.
- The default value of
Unity.Physics.PhysicsStep.ThreadCountHinthas been increased from 4 to 8. EndFramePhysicsSystemno longer waits forHandlesToWaitFor, instead it produces aFinalJobHandlewhich is a combination of those jobs plus the built-in physics jobs. Subsequent systems that depend on all physics jobs being complete can use that as an input dependency.
- Authoring/Conversion Behavior
PhysicsCustomDatais now converted fromPhysicsBody.CustomTagsinstead of using the flags common to all leaf shapes.PhysicsShape.CustomTagsis now converted intoMaterial.CustomTags.- If a shape conversion system throws an exception when producing a
PhysicsCollider, then it is simply skipped and logs an error message, instead of causing the entire conversion process to fail. PhysicsShapeInspector now displays suggestions of alternative primitive shape types if a simpler shape would yield the same collision result as the current configuration.PhysicsShapeInspector now displays error messages if a custom mesh or discovered mesh is not compatible with run-time conversion.
Fixes
- Draw Collider Edges now supports spheres, capsules, cylinders and compound colliders.
- Fixed bug causing editor to get caught in infinite loop when adding
PhysicsShapecomponent to a GameObject with deactivated children withMeshFiltercomponents. - Fixed bug resulting in the creation of
PhysicMaterialobjects in sub-scenes when converting legacy colliders. - Fixed bug when scaling down friction on bounce in Jacobian building. Once a body was declared to bounce (apply restitution), all subsequent body Jacobians had their friction scaled down to 25%.
- Fixed bug resulting in the broadphase for static bodies possibly not being updated when adding or moving a static body, causing queries and collisions to miss.
- Fixed bug with restitution impulse during penetration recovery being too big due to wrong units used.
- Fixed bug with energy gain coming from restitution impulse with high restitution values.
- Fixed Jacobian structures being allocated at non 4 byte aligned addresses, which caused crashes on Android
- Removed Solver & Scheduler asserts from Joints between two static bodies #383.
- Fixed bug preventing the conversion of classic
BoxCollidercomponents with small sizes. - Fixed bug where
PhysicsShape.ConvexRadiussetter was clamping already serialized value instead of newly assigned value. - Fixed bug where
PhysicsShapeorientation, size, and convex radius values might undergo changes during conversion resulting in identical volumes; only objects inheriting non-uniform scale now exhibit this behavior. - Fixed bug causing minor drawing error for cylinder
PhysicsShapewith non-zero convex radius. - Fixed crash when trying to run-time convert a
MeshColliderorPhysicsShapewith a non-readable mesh assigned. Conversion system now logs an exception instead. - Fixed crash when constructing a
MeshColliderwith no input triangles. A valid (empty) mesh is still created. - Fixed bugs building to IL2CPP resulting in unresolved external symbols in
BvhLeafProcessor,ConvexCompoundLeafProcessor, andConvexMeshLeafProcessor. - Fixed bug causing physics IJob's to not be burst compiled (ICollisionEventsJob, ITriggerEventsJob, IBodyPairsJob, IContactsJob, IJacobiansJob)
[0.1.0-preview] - 2019-05-31
Upgrade guide
- Any run-time code that traversed the transform hierarchy of physics objects to find other entities must instead store references to entity IDs of interest through a different mechanism.
- Baking of non-uniform scale for parametric
PhysicsShapetypes has changed to more predictably approximate skewed render meshes. Double check the results on any non-uniformly scaled objects in your projects. - Angular Velocity is currently set in Motion Space. The Motion Space orientation of dynamic bodies may have changed with the changes to the conversion pipeline. If dynamic bodies are now rotating differently, check the values of
Initial Angular Velocityin thePhysicsBodycomponent, or values set toAngularin thePhysicsVelocitycomponent. - Convex
PhysicsShapeobjects with no custom mesh assigned now include points from enabled mesh renderers on their children. Double check any convex objects in your projects. - The
RaycastInputandColliderCastInputstructs have changed. See below for details.
Changes
- Run-Time API
- Renamed
CollisionFilter.CategoryBitstoCollisionFilter.BelongsTo. - Renamed
CollisionFilter.MaskBitstoCollisionFilter.CollidesWith. RaycastInputandColliderCastInputhave changed:- At the input level, start and end positions are now specified rather then an initial position and a displacement.
StartreplacesPosition.EndreplacesDirectionwhich had been confusing as it was actually a displacement vector to a second point on the ray.Rayhas been made internal as a lower level interface and updated to be less ambiguous.
- Added job interfaces for easier reading of simulation events, instead of having to work directly with block streams.
ICollisionEventsJobcallsExecute()for every collision event produced by the solver.ITriggerEventsJobcallsExecute()for every trigger event produced by the solver.- These events now also include the Entity's involved, not just the rigid body indices.
- Added job interfaces for easier modification of simulation data, instead of having to work directly with block streams.
IBodyPairsJobcallsExecute()for every body pair produced by the broad phase.IContactsJobcallsExecute()for every contact manifold produced by the narrowphase.IJacobiansJobcallsExecute()for every contact jacobian before it is solved.
- Renamed
- Authoring/Conversion API
- Renamed
SecondPassLegacyRigidbodyConversionSystemtoLegacyRigidbodyConversionSystem. - Deprecated
FirstPassPhysicsBodyConversionSystem. - Renamed
SecondPassPhysicsBodyConversionSystemtoPhysicsBodyConversionSystem. - Deprecated
FirstPassLegacyRigidbodyConversionSystem. - Deprecated overload of
PhysicsShape.GetCapsuleProperties()returning raw points. - Deprecated overload of
PhysicsShape.GetPlaneProperties()returning raw points. - Renamed
PhysicsShape.FitToGeometry()toPhysicsShape.FitToEnabledRenderMeshes(). New method accounts for enabledMeshRenderercomponents on child objects with the same physics body and leaf shape. PhysicsShape.GetConvexHullProperties()now includes points from enabledMeshRenderercomponents on child objects with the same physics body and leaf shape when no custom mesh has been assigned.
- Renamed
- Run-Time Behavior
- Added a fixed angle constraint to prismatic joints so they no longer rotate freely.
- Any Entity with a
PhysicsVelocitycomponent will be added to thePhysicsWorldand integrated, even if it has noPhysicsCollider.
- Authoring/Conversion Behavior
- Physics data on deactivated objects in the hierarchy are no longer converted.
- All physics objects (i.e. bodies) are now un-parented (required since all simulation happens in world space).
- Legacy
Collidercomponents are no longer converted if they are disabled. - Converted
PhysicsShapeobjects with non-uniform scale now bake more predictable results when theirTransformis skewed. - All menu paths for custom assets and authoring components have changed from 'DOTS Physics' to 'DOTS/Physics'.
Fixes
- Fixed trigger events not being raised between kinematic-vs-kinematic or kinematic-vs-static body pairs.
- Fixed crash in BuildPhysicsWorld when creating a dynamic body without a
PhysicsMasscomponent - Cylinder/sphere GameObjects no longer appear in first frame when draw colliders is enabled on
PhysicsDebugDisplay. - Fix bugs in
BoundingVolumeHierarchy.Buildwhich now producesBoundingVolumeHierarchyof greater quality. This will affect performance of BVH queries, and most notably it will significantly improve performance ofDynamicVsDynamicFindOverlappingPairsJob - Fixed incorrect 3DOF angular constraint solving with non-identity joint orientation
- Fixed bug where converted
SphereColliderwould apply incorrect center offset when in a hierarchy with non-uniform scale. - Fixed bug where converted
PhysicsShapewould not become part of a compound collider at run-time if the firstPhysicsBodyancestor found higher up the hierarchy was disabled. - Fixed bug where leaves of compound shapes in a hierarchy might be added to the wrong entity if it had disabled
UnityEngine.Collidercomponents. - Fixed bug causing leaves of compound shapes on prefabs to convert into individual static colliders.
- Fixed restitution response to be more bouncy for convex objects with high restitution values
- Fixed bug where a converted GameObject in a hierarchy would have the wrong translation and rotation at run-time.
- Fixed bug where objects with
StaticOptimizeEntitywould not be converted into physics world. - Preview for Mesh
PhysicsShapeno longer culls back faces. - Inspector control for convex radius on
PhysisShapenow appears when shape type is convex hull.
Known Issues
- Attempting to fit a non-uniformly scaled
PhysicsShapeto its render meshes may produce unexpected results. - Physics objects loaded from sub-scenes may have the wrong transformations applied on Android.
- Dragging a control label to modify the orientation of a
PhysicsShapesometimes produces small changes in its size. - If gizmos are enabled in the Game tab, the 'Physics Debug Display' viewers are incorrectly rendered. Debug viewers render correctly in the Scene tab.
[0.0.2-preview] - 2019-04-08
Upgrade guide
- Any assembly definitions referencing
Unity.Physics.Authoringassembly by name must be updated to instead referenceUnity.Physics.Hybrid.
Changes
- Renamed
Unity.Physics.Authoringassembly toUnity.Physics.Hybrid. (All of its types still exist in theUnity.Physics.Authoringnamespace.) - Radius of cylinder
PhysicsShapeis no longer non-uniformly scaled when converted.
Fixes
- Fixed exception when converting a box
PhysicsShapewith negative scale. - Fixed incorrect orientation when fitting capsule, cylinder, or plane
PhysicsShapeto render mesh. - Fixed convex radius being too large when switching
PhysicsShapefrom plane to box or cylinder. - Fixed calculation of minimum half-angle between faces in convex hulls.
- Fixed collision/trigger event iterators skipping some events when iterating.
- Fixed memory leak when enabling "Draw colliders" in the Physics Debug Display.
Known Issues
- Physics systems are tied to (variable) rendering frame rate when using automatic world bootstrapping. See
FixedTimestepexamples in ECS Samples project for currently available approaches. - IL2CPP player targets have not yet been fully validated.
- Some tests might occasionally fail due to JobTempAlloc memory leak warnings.
- Swapping
PhysicsShapecomponent between different shape types may produce non-intuitive results when nested in hierarchies with non-uniform scale. - Some
PhysicsShapeconfigurations do not bake properly when nested in hierarchies with non-uniform scale. PhysicsShapedoes not yet visualize convex hull shapes at edit-time.- Drag values on classic
Rigidbodycomponents are not currently converted correctly.
[0.0.1-preview] - 2019-03-12
- Initial package version