Toolkit for Unity Physics 6.0 is a breaking release. This page lists what changed since 5.x and what to do about it. Items 2 to 9 can change behaviour in an existing project, so go through them before you update.
- Install Game Framework 1.4.0 or later. Toolbox does this for you. Toolkit for Unity Physics now uses it for System Log. Burst is also a package dependency now.
- Force effect overrides have new signatures.
LinearEffectandAngularEffectare now(in ForceSource source, float strength, Rigidbody subject), withRigidbody2Dfor 2D. They used to take aVector3 originand aPhysicsData.ForceEffectSource.AddForcetakes aRigidbody, andForceEffectReceiverno longer requiresPhysicsData. Update any custom effects, see Force Effects for the newForceSourcetype. - Wind direction and force. Wind blows along a
ForceEffectDirection‘s forward axis and outward from aForceEffectField. It used to push against the direction. It no longer needs Rigidbody damping above zero: the force is now real drag using the body’s actual shadow fromPhysicsData, orfallbackCrossSection, and the torque comes from the force acting at the centre of volume. The defaults changed to 8 m/s, gusts at 0.3 Hz, turbulence 0.15, and the direction swing is capped at 30 degrees (it could reach 90).API.Maths.SimulateWindForcetakes the gust frequency in cycles per second. - Field falloff is by distance. The curve now runs from 0 at the source to 1 at
radius(orreach), and the default is full strength at the source falling to zero. It used to run the other way. Beyond the radius the strength stays at the end of the curve, there is no cutoff. A non-global field affects the bodies inside its trigger collider, so a non-global field with no trigger affects nothing: make it global or add a trigger. A gravity well with a large trigger needs a matchingradiusor a constant curve. - Effect meanings changed. Gravity strength is an acceleration and cancels world gravity on bodies inside the field by counter acceleration, and no longer switches
Rigidbody.useGravityoff permanently. Tractor strength is a speed in metres per second (newmaxAccelerationandarrivalDistance). Suspend strength is a rate in 1 per second, independent of the time step. Attract and Repulse are unchanged apart from a torque fix. See Effect Types. - PhysicsData is scale-correct and baked. The hull is stored at unit scale and every query applies the current lossy scale, which fixes volume, area and cross sections that were wrong for scaled and nested objects.
volume,area,xCrossSection,yCrossSectionandzCrossSectionare now read-only properties (Volume,Areaand so on). The hull is built from the rendered meshes (lower LODs ignored) or colliders, baked in the editor and stored on the component, with no work inAwake. Bake existing objects with Help, Heathen, Unity Physics, Bake All PhysicsData in Open Scenes and in Project Prefabs. See Physics Data. - API.Maths changes.
GetForwardDirection(float3)is renamedLookRotation, andGetForwardDirection(Quaternion)now returns the forward vector.InterceptTime(speed, relativePosition, targetVelocity)takes the target velocity.QuadraticDragtakes the fluid velocity relative to the body and returns the force along the flow. See Physics Maths. - The convex hull library moved to the namespace and assembly
Heathen.UnityPhysics.MIConvexHull. It used to be a publicMIConvexHull. Update any code that referenced it directly. - Smaller behaviour changes.
ForceEffectDirection2Dacts along its right axis.ConstantAngularVelocityholds spin with torque.Breakable.breakForceis a relative impact speed in metres per second. - Buoyancy is a legacy feature. It keeps working in 6.x and is not changing, but it is no longer developed and is planned for deprecation. See the Overview.
- Samples import to
Assets/Samples/Toolkit for Unity Physics/6.0.0/Example Scenes. Copies you already imported are not updated, so re-import to get the new ones.
Fixed in 6.0 #
SafeInterceptreturned wrong points, and null for the heading form. It is now exact.- The torque to face a direction did nothing when facing away and was wrong beyond 90 degrees, and the 2D version folded large angles and mixed degrees with radians.
- Force receivers threw every step after a field they were inside was destroyed, and
IsGlobalset from code had no effect. - Wind turbulence clamped into a lopsided range and gusts used the wrong frequency.
SolveQuarticdropped the zero root and allocated, andNearestPointOnLineSegmentreturned NaN for a zero-length segment.Breakablethrew without intact or broken objects or without events,MeshToolsreplaced the MeshFilter mesh it read, and hull building was quadratic.