Phaser: StaticBody#setCircle offset not working and also not rendering as circle in debug

Created on 15 Nov 2018  路  4Comments  路  Source: photonstorm/phaser

Version

Description


I have identified two problems:

  1. A StaticBody whose body has been set to a circle with setCircle does not render as a circle in debug. However the collision body is in fact a circle.
  2. The offset parameters appear not to actually offset the body. In this case I observe that the render and collision body are both not offsetting.

Example Test Code


I made a codepen with a few bodies.
There are two staticbodies on the left.
The top one is square, the bottom is circle. They both render as square in debug.
I added moving bodies to collide with them. You can see the bottom moving body collides with the circle and bounces off at an angle, confirming the circular collision.

Also please try changing the offset for the static bodies, it has no effect.

https://codepen.io/maikthomas/pen/OaMRGb

Additional Information

Related forum post I made, has screenshots and code but not complete sample for running: http://www.html5gamedevs.com/topic/41088-setcircle-doesnt-work-on-a-staticgroup-game-object/
It at least shows how for non static bodies the debug render works as expected.

P.s. many thanks for all your effort, I'm new to Phaser and it is great! 馃憦

All 4 comments

Think these are linked https://github.com/photonstorm/phaser/issues/4213
As far as I can tell no static body offset methods are working correctly.

Hiya, thank you for opening this (all those months ago!) - static bodies now debug draw properly thanks to your PR and setOffset definitely now works for Static bodies, too, as tested in 3.20.

@Rayanfer32

Screen Shot 2020-04-03 at 11 29 35 AM

i had to switch to dynamicgroup

Was this page helpful?
0 / 5 - 0 ratings