Jump to content

Search the Community

Showing results for tags 'CCD'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi! I'm using p2 physics to implement a platformer. One of the things I want to do is latch the player onto the (polygonal) path when he's not jumping or falling, and basically treat it like a straight horizontal in terms of movement. I have successfully implemented a system to get the current angle of the ground and move the player tangentially to it, but I'm having trouble with the player's behavior when he lands. I would like to avoid him bouncing back upon impact, so I set restitution to 0. Still, there is some bounce because the shapes overlap on impact and are only separated in the next step. I played around with the relaxation parameter, but at 0 the player shoots out of the shape, and at higher values than 1 he gets stuck in the shape for a little while and slowly eases out of it. So I'm keeping it at 1. I added a long, narrow rectangular p2 body to my player, which I orient in his current movement direction (so that if he's falling down, it's pointing down, when he's walking left, it points left, etc). I use the collisions this body provides to find the shapes that the player would impact with if he continued to move in his current direction. I then check the distance of my player's body to these shapes, and I want to limit the velocity at which he goes precisely so that instead of overlapping the shape on impact, he comes to rest flush against the ground/obstacle/ceiling in question. And there's my problem: I cannot seem to set the right values at the right time. Here are two consecutive frames of an impact: Fig.1 Fig. 2 The orange line is a record of my player's position, the red line is the narrow rectangle feeler. As you can see, the player dips into the ground pretty severely there upon impact. The green line is drawn between the point on the player's circular p2 body that was closest to the impact surface BEFORE the impact (in Fig.1), and the point where it would impact if I managed to do it right (i.e., the shortest vector between the player and the ground). The black line is drawn from the aforementioned hull point into the direction of movement. I don't know why it only drew those after it already had impacted - the data is available in the update function while the pre-impact frame is still visible, and I do set the velocity so that it SHOULD not overlap in the next frame. And yet it does. Do you have an idea why that should be?
×
×
  • Create New...