Jump to content

Search the Community

Showing results for tags 'ContactMaterial'.

  • 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 2 results

  1. 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
  2. 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.game.physics.p2.createContactMaterial(this.playerMaterial, 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.
×
×
  • Create New...