Jump to content

how to use p2 capsule (and make it visible)


valueerror
 Share

Recommended Posts

hello everybody!

 

since one of rich's answers to the problem was to use a capsule (instead of a circle/rectangle)  i tried to do this (although i don't actually understand how this could solve the problem)

 

one problem with capsules is that it make the mentioned problem even worse (my player can now walk up walls for some reason)   

 

the main problem with this is that i don't see the physics body.. i always see a rectangle with the exact size of the sprite but altering parameters of the capsule changes the behavior of my player so i am certain it is applied correctly but not displayed.

 

 

if i do this:  (math.radians is a custom function to convert deg to rad)

 playershape = player.body.addCapsule(100,15,0,0,Math.radians(90))

my player (which is 50 pixels in height) hovers about 25 pixels over the ground.. this seems to be correct because i set the distance between the two points to 100  .. 

 

it looks like this:

 

 

post-6912-0-61715400-1398682246.png

Link to comment
Share on other sites

Oh there seems to be no debug method to draw the capsule! I simply forgot this back in the days. This can be seen in BodyDebug#draw, there is only support for Circle, Convex, Plane, Line & Rectangle. I will fix this as soon as I can. That's why you see the wrong shape with the correct behaviour.

 

Regards George

Link to comment
Share on other sites

  • 1 month later...

Hi George,

 

I'm having the same problem. With phaser v2.0.5 I also cannot debug the capsule and the behavior is very strange. Can you please tell me about the status of the debug draw?

 

Thanks, BR, toovy

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...