Search the Community

Showing results for tags 'ContactMaterial'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 3 results

  1. Hello everyone, this is my first time posting on this forum, which means I'm pretty desperate at this point haha! I'm trying to make a simple game where a character is sliding down a hill, this is what I got so far: I want to make the hill as slippery as ice, just like some ice parts in this game: I learned a lot from this game btw. I tried to copy how the user made his ice material, but it doesn't seem to work in my game! // Create ramp and player from tiles sharp =,"points"); player =,10, 'player'); // Define materials groundMaterial =; playerMaterial ='player'); // Give the ramp material for (i=0; i<sharp.length; i++){ sharp[i].setMaterial(groundMaterial); } // define what happens when one material contacts the other, groundMaterial, { friction: 0 , restitution: 0 }); What am I doing wrong? Please help me
  2. Hi everyone, Just a quick question for those with experience using P2. I'm creating a simple 2D sidescrolling golf game (using Typescript) and I've set up a polygon array creating random terrain Y points and a ball with P2 physics. The collisions between both using the contact material work perfectly, including Restitution and Surface Velocity but I was wondering if there was anyway to create drag when the ball rolls over the terrain. Just now, if there is even a slight hint of angle to a hill the ball will continue to roll down it due to gravity without any drag to slow it, or even if its flat it will continue at a steady pace. I've tried changing the contact material's friction to extremely high but this doesn't seem to have much affect slowing the velocity. Here's the settings for my contact material: this.contactMaterial.friction = 1e7; this.contactMaterial.restitution = 0.4; this.contactMaterial.surfaceVelocity = 0; // contactMaterial.stiffness = 1e7; // contactMaterial.relaxation = 3; // contactMaterial.frictionStiffness = 1e7; // this.contactMaterial.frictionRelaxation = 0.1; The temporary fix would be to call an event for when the two materials are touching which slows the ball's velocity to closer to 0, but I'm sure theres something easier I'm just missing as this is my first time using P2. Also as a little extra, could someone explain what the commented out properties of the material do? I know roughly what stiffness and relaxation do with Springs but I'm not too sure what affect they have in contact materials - they are probably the properties I need properly set to achieve my drag! Thanks as ever guys! SeeJay
  3. Hi gamer!I am upgrading from version 2.0.2. I tried version 2.0.4 and it seems that everything was fine until the player has collided with a material that makes a bounce. In version 2.0.2 worked perfectly. In 2.0.3 and 2.0.4 a strange thing happens. All sprites move to (0,0) and the game crashes, no error in console. The contact material is as follows:, this.material2, { friction: 0, // Friction to use in the contact of these two materials. restitution: 1.1, // Restitution (i.e. how bouncy it is!) to use in the contact of these two materials. stiffness: 1e7, // Stiffness of the resulting ContactEquation that this ContactMaterial generate. relaxation: 0, // Relaxation of the resulting ContactEquation that this ContactMaterial generate. frictionStiffness: 1e7, // Stiffness of the resulting FrictionEquation that this ContactMaterial generate. frictionRelaxation: 10, // Relaxation of the resulting FrictionEquation that this ContactMaterial generate. surfaceVelocity: 0.0 }); Any idea what happens? The ruling is impossible to upgrade ... A greeting.