Return to the Change Log index.
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:
Body.setAngularVelocity
and Body.setVelocity
functions to be timestep independentBody.setSpeed
, Body.setAngularSpeed
, Body.getSpeed
, Body.getVelocity
and Body.getAngularVelocity
updateVelocity
argument to Body.setPosition
, Body.setAngle
, Body.translate
and Body.rotate
correction
parameter from Engine.update
as it is now built-inBody.setAngularVelocity
and Body.setVelocity
to be timestep independent60hz
as a baselineBody.setSpeed
, Body.setAngularSpeed
, Body.getSpeed
, Body.getVelocity
, Body.getAngularVelocity
updateVelocity
argument to Body.setPosition
, Body.setAngle
, Body.translate
, Body.rotate
Body.applyForce
Engine.update
to be built-in to Matter.Body
body.deltaTime
propertyspeed
setters to Body.set
updateVelocity
argument to Body.setPosition
, Body.setAngle
, Body.translate
and Body.rotate
collisionStart
event to trigger after resolving and after updating body velocitiesConstraint.pointAWorld
and Constraint.pointBWorld
Body.applyForce
docsNotes
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:
Matter.Grid
with a faster and more efficient broadphase in Matter.Detector
.Matter.SAT
related to collision reuse.Matter.Grid
.MatterPhysics.collision
is a new reference to the Collision
module, which now handles all Matter collision events.MatterPhysics.grid
has been removed as this is now handled by the Collision
module.MatterPhysics.sat
has been removed as this is now handled by the Collision
module.Matter.Body.previousPositionImpulse
property 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
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )