Return to the Change Log index.
The old MatterWrap
plugin has been deprecated in favour of native integration into the new Matter.Body.wrap
method.
This method ensures that a body's position is always maintained within specified bounds. If the body crosses a boundary, it will appear on the opposite side of the bounds, preserving its velocity. This enhancement eliminates the need for enabling the wrap
method through the Matter physics MatterConfig
option by adding wrap: true
to the plugins property.
To utilize the new wrap
functionality, you can now directly pass a wrapBounds
object specifying the x
and y
boundaries when creating a new Matter object. This approach simplifies the process of applying boundary wrapping to Matter bodies.
wrapBounds
object that specifies min
and max
coordinates for x
and y
. const wrapBounds = {
min: {
x: 0,
y: 0
},
max: {
x: 800,
y: 600
}
};
const gameObject = this.matter.add.image(x, y, 'key', null, {
wrapBounds: wrapBoundary
});
wrapBounds
property on the game object body to null
. Example: gameObject.body.wrapBounds = null;
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )