Jump to content

Search the Community

Showing results for tags 'p2 physics collision abort'.

  • 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. hey everyone! I'm new to phaser and I'm running into a little problem using the P2 physics engine: I have objects moving from top to bottom and the player at the very bottom (imagine a little shmup here). I want all of the objects to stop moving the moment the player touches either object. I've set up collisionGroups for the objects and the player and I've set a onBeginContact listener on the player's body. Problem is: everything stops just fine but the player and the object hit both keep moving slowly away from one another. I assume it's because the actual collision is being executed after the onBeginContact signal has been dispatched since setting both bodies' velocities to 0 doesn't help. Here is the full listener function I use: onPlayerCollision: function (body, shapeA, shapeB, equation){ // stop all hazards from scrolling this.hazards.setAll('body.velocity.y', 0); // prevent player from moving this.player.body.setZeroVelocity(); // stop the background tile scrolling this.ground.stopScroll(0, 0); // stop the timer this.timer.stop(true); // pause the update loop this.isRunning = false;},So my question is: is there a way to cancel the execution of the contact or do I need to take a completely different approach? I'd rather avoid using impacts since the docs say they're expensive. I saw that an array of equation objects is being passed to the hit function but I didn't find anything in the docs about what I could possibly do with these and the log output is a massive load of data.
×
×
  • Create New...