5.2 KiB
Phaser 3.60.0 Change Log
Return to the Change Log index.
New Feature - Matter Physics v0.19
We have updated the version of Matter Physics to the latest v0.19 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:
- Improves general consistency of results between different timesteps based on 60hz as a baseline
- Changes
Body.setAngularVelocityandBody.setVelocityfunctions to be timestep independent - Adds timestep independent
Body.setSpeed,Body.setAngularSpeed,Body.getSpeed,Body.getVelocityandBody.getAngularVelocity - Adds optional
updateVelocityargument toBody.setPosition,Body.setAngle,Body.translateandBody.rotate - Removes
correctionparameter fromEngine.updateas it is now built-in - Changed
Body.setAngularVelocityandBody.setVelocityto be timestep independent - Improved similarity of results between different timesteps based on
60hzas a baseline - Added timestep independent
Body.setSpeed,Body.setAngularSpeed,Body.getSpeed,Body.getVelocity,Body.getAngularVelocity - Added optional
updateVelocityargument toBody.setPosition,Body.setAngle,Body.translate,Body.rotate - Added extended documentation for
Body.applyForce - Moved time correction feature from
Engine.updateto be built-in toMatter.Body - Added readonly
body.deltaTimeproperty - Added
speedsetters toBody.set - Added
updateVelocityargument toBody.setPosition,Body.setAngle,Body.translateandBody.rotate - Changed engine
collisionStartevent to trigger after resolving and after updating body velocities - Derive velocity from position in setters
- Fixed issues with engine event.delta
- Handle null constraint points in
Constraint.pointAWorldandConstraint.pointBWorld - Improved
Body.applyForcedocs - Improved delta factors in resolver and constraint stiffness
- Improved Matter.Body docs for functions and properties including readonly
- Improved Matter.Engine docs
- Improved delta consistency
- Removed render element warning
- Removed unused delta params
- Updated body velocity properties after resolving
- Updated timing improvements
- Used Body.getVelocity in Matter.Render
- Used speed getter in Matter.Sleeping and Matter.Render
Notes
When using a fixed timestep of 60hz (~16.666ms engine delta) results should look similar to before, as this was taken as the baseline.
If you're using a non-fixed timestep or one other than 60hz (~16.666ms) results should now become more similar to the 60hz baseline, therefore you may need to adjust e.g. body and constraint properties.
Since Body.setAngularVelocity and Body.setVelocity are now timestep independent, you may need to adjust code you may have been using that factored in the timestep.
For timestep independence, the Matter.Body speed and velocity getter and setter functions now relate to a fixed time unit rather than timestep, currently set as 1000/60 for easier backwards compatibility at the baseline 60hz.
Note that Body.applyForce naturally still remains timestep dependent as before, see the updated Body.applyForce docs for details.
While the properties body.velocity and body.speed (and angular versions) still exist they are not typically recommended for user code, in most cases you should switch to the new Body.getVelocity and Body.getSpeed functions as they are timestep independent.
The following changes came from the v0.18 release, which are also part of v0.19:
- Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)
- Replaces
Matter.Gridwith a faster and more efficient broadphase inMatter.Detector. - Reduced memory usage and garbage collection.
- Resolves issues in
Matter.SATrelated to collision reuse. - Removes performance issues from
Matter.Grid. - Improved collision accuracy.
MatterPhysics.collisionis a new reference to theCollisionmodule, which now handles all Matter collision events.MatterPhysics.gridhas been removed as this is now handled by theCollisionmodule.MatterPhysics.sathas been removed as this is now handled by theCollisionmodule.- The
Matter.Body.previousPositionImpulseproperty has been removed as it's no longer used.
Because of the changes above, the following new methods are available to any Phaser Matter Physics Game Object:
getVelocity- Returns the current linear velocity of the Body as a Vec2.getAngularVelocity- Returns the current rotation velocity of the Body.setAngularSpeed- Sets the current rotational speed of the body. Direction is maintained. Affects body angular velocity.getAngularSpeed- Returns the current rotational speed of the body. Equivalent to the magnitude of its angular velocity.
Return to the Change Log index.
📖 Read the Phaser 3 API Docs 💻 Browse 2000+ Code Examples 🤝 Join the awesome Phaser Discord
