A new property was added to Matter.World, correction which is used in the Engine.update call and allows you to adjust the time being passed to the simulation. The default value is 1 to remain consistent with previous releases.

This commit is contained in:
Richard Davey 2018-03-23 02:19:18 +00:00
parent 7f781786b7
commit 574221d6cf
2 changed files with 25 additions and 3 deletions

View file

@ -2,12 +2,22 @@
## Version 3.3.1 - Tetsuo - In Development
### New Features
* A new property was added to Matter.World, `correction` which is used in the Engine.update call and allows you to adjust the time
being passed to the simulation. The default value is 1 to remain consistent with previous releases.
### Bug Fixes
* In the WebGL Render Texture the tint of the texture was always set to 0xffffff and therefore the alpha values were ignored. The tint is now calculated using the alpha value. Fix #3385 (thanks @ger1995)
### Updates
## Version 3.3.0 - Tetsuo - 22nd March 2018
A special mention must go to @orblazer for their outstanding assistance in helping to complete the JSDoc data-types, callbacks and type defs across the API.

View file

@ -118,6 +118,20 @@ var World = new Class({
*/
this.enabled = GetValue(config, 'enabled', true);
/**
* The correction argument is an optional Number that specifies the time correction factor to apply to the update.
* This can help improve the accuracy of the simulation in cases where delta is changing between updates.
* The value of correction is defined as delta / lastDelta, i.e. the percentage change of delta over the last step.
* Therefore the value is always 1 (no correction) when delta constant (or when no correction is desired, which is the default).
* See the paper on Time Corrected Verlet for more information.
*
* @name Phaser.Physics.Matter.World#correction
* @type {number}
* @default 1
* @since 3.3.1
*/
this.correction = GetValue(config, 'correction', 1);
/**
* [description]
*
@ -592,9 +606,7 @@ var World = new Class({
{
if (this.enabled)
{
var correction = 1;
Engine.update(this.engine, delta, correction);
Engine.update(this.engine, delta, this.correction);
}
},