valueerror

how to use p2 capsule (and make it visible)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.