Search the Community

Showing results for tags 'p2'.

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 335 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. there are several occations where my player gets faster and faster all the time without limit.. (this is on purpose but it shouldn't end up in lightspeed.. a velocity of 800-1000 would be more than enough) how would i define such a limit and make sure it's applied? thx in advance
  3. Hi, I develop a game which uses P2 and collisions. But in the latest versions, the behavior of move, speed and collision are very different. My reference example is “World move” between Phaser 2.0.6 and the lastest version. I think the move behavior is more realistic in Phaser 2.0.6. So, how to keep these behaviors with the last version? I have made live examples with jsbin, to see the differences : Test 1: moveforward 3000 + angle 90 The ball bounces many times, and the speed gradually slows Phaser 2.0.6:,js,output The ball bounces one time and nothing… Phaser 2.1.2:,js,output Test 2: moveforward 1000 + angle 60 The ball bounce many times, and the direction is fine for each bounce. Phaser 2.0.6:,js,output Indescribable… Phaser 2.1.2:,js,output What do you think about that? Can we have the movement from 2.0.6 with the latest version?
  4. i dont know about the internals of phaser but i could imagine that using collision groups instead of letting everything collide with everything and filter the relevant infos in the begincontact event would be faster because phaser/p2 doesnt need to check everything against everything.. right or totally wrong because collisiongroups create an aditional overthead?
  5. I am having some performance issues with collision groups on mobile. I have 13 enemy sprites in game that collide with map polygon boundaries. Having the enemy sprites in game degrades the fps from 60fps down to 30fps. As I reduce the number of enemies in game the fps increases. 13 seems like a really small number of sprites to have in game so I feel like I must be setting up the collision detection incorrectly. I am trying to setup a base map with polygons to use for collision boundaries of the map. I want to have enemies go back and forth horizontally between the map boundaries. They will change direction (both a change in x velocity and flipping the scale so they visual point the opposite direction) when they make contact with the boundary. Is this the proper way to setup this type of collision detection? If so, any thoughts on why it is so slow on mobile devices (testing on iPhone 5)? Here is the code I currently have: // Init gamevar game = new Phaser.Game(1024, 640, Phaser.CANVAS, 'test-game'); // Load the assetsgame.load.image('level01', 'assets/level01.png'); // Image 1024x4608 game.load.physics('level01_physics', 'assets/level01_physics.json'); // Physics data format is Lime + Corona (JSON)// Setup collision groups var landCG = game.physics.p2.createCollisionGroup(); var enemyCG = game.physics.p2.createCollisionGroup();// Load map background imagevar map = this.add.sprite(0, 0, 'level01');// Create sprite and load polygon physics data for the map boundaries var mapCollisionPolygons = this.add.sprite(15, 15); this.physics.p2.enableBody(mapCollisionPolygons, false); mapCollisionPolygons.fixedRotation = true; mapCollisionPolygons.body.motionState = Phaser.Physics.P2.Body.STATIC; mapCollisionPolygons.body.clearShapes(); mapCollisionPolygons.body.loadPolygon('level01_physics', 'left'); mapCollisionPolygons.body.loadPolygon('level01_physics', 'right'); mapCollisionPolygons.body.setCollisionGroup(landCG); mapCollisionPolygons.body.collides(enemyCG); // Create a new enemy and setup collision var enemy = new Enemy(game, 100, 100, 100, 100, 100); enemy.body.setCollisionGroup(enemyCG); enemy.body.collides(landCG, enemy.collided, enemy); The extended Sprite class called 'Enemy': var Enemy = function (game, x, y) { this.hasCollided = false; this.speed = 100;, game, x, y, 'boat'); game.physics.p2.enable(this); this.body.fixedRotation = true; this.body.motionState = Phaser.Physics.P2.Body.DYNAMIC; this.body.onEndContact.add(this.endCollided, this); game.add.existing(this); return this;};Enemy.prototype = Object.create(Phaser.Sprite.prototype);Enemy.prototype.constructor = Enemy;Enemy.prototype.update = function() {};Enemy.prototype.collided = function(body1, body2) { if(!this.hasCollided) { this.scale.x *= -1; this.speed *= -1; this.body.velocity.x = this.speed; this.hasCollided = true; }};Enemy.prototype.endCollided = function(bodyB, shapeA, shapeB) { this.hasCollided = false;};module.exports = Enemy;The 'assets/level01_physics.json' file: { "left": [ { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 0, 4608 , 224, 4016 , 384, 4056 , 384, 4608 ] } , { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 384, 264 , 224, 303 , 0, 0 , 384, 0 ] } , { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 224, 4016 , 0, 4608 , 0, 0 , 224, 303 ] } ] , "right": [ { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 640, 4056 , 800, 4016 , 1024, 4608 , 640, 4608 ] } , { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 1024, 0 , 800, 303 , 640, 264 , 640, 0 ] } , { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 800, 4016 , 800, 303 , 1024, 0 , 1024, 4608 ] } ] }Here is a link to a related post with some of my performance testing with different options for displaying the background map and boundaries in case it helps.
  6. I am new to Phaser and I am currently working on my first game. I'm am creating a vertical scroller and have come across some performance issues on mobile. I have a 1024x4608 background with some 'land' that needs collision detection with the 'player' and the 'enemies' in the game. I've been trying a couple approaches but can't seem to find the sweet spot with the performance. I was hoping someone would have some suggestions. Here's what I've tried so far: 1) Tilemap this.load.tilemap('level01_map', 'assets/level01_map.json', null, Phaser.Tilemap.TILED_JSON);this.load.image('tiles', 'assets/tiles.png'); = this.add.tilemap('level01_map');'main', 'tiles');'land');, 0,,;[], true, 'land');var bodyObjects = this.physics.p2.convertTilemap(, 'land');for(var i = 0; i < bodyObjects.length; i++) { bodyObjects[i].setCollisionGroup(this.gameGroups.landCG); bodyObjects[i].collides(this.gameGroups.playerCG); bodyObjects[i].collides(this.gameGroups.enemyCG);} 2) Sprite with polygons this.load.image('level01', 'assets/level01.png');this.load.physics('level01_physics', 'assets/level01.json');, 0, 1024, 4608); = this.add.sprite(0, 0, 'level01'); = 1024; = 4608;var polygonCollisionSprite = this.add.sprite(15, 15);this.physics.p2.enableBody(polygonCollisionSprite, true);polygonCollisionSprite.fixedRotation = true;polygonCollisionSprite.body.motionState = Phaser.Physics.P2.Body.STATIC;polygonCollisionSprite.body.clearShapes();polygonCollisionSprite.body.loadPolygon('level01_physics', 'level01_left');polygonCollisionSprite.body.loadPolygon('level01_physics', 'level01_right');polygonCollisionSprite.body.setCollisionGroup(this.gameGroups.landCG);polygonCollisionSprite.body.collides(this.gameGroups.playerCG);polygonCollisionSprite.body.collides(this.gameGroups.enemyCG); And here are my results testing on an iPhone 5:Tilemap no collisions = 45fps Tilemap with collisions = 20fps Sprite/polygons no collisions = 45fps evens out to 60fps when less polygons in view Sprite/polygons with collisions = 8fps Sprite/polygons (simple) no collisions = 60fps Sprite/polygons (simple) with collisions = 30fps Note: simple means I reduced the vertices in the polygons. (Simple = 6 shapes, Normal = 44 shapes) The game is setup with 1024x640 in Phaser.CANVAS mode. Also, the all sprite assets, except the stuff for the background, are being load via one atlas texture. Any thoughts?
  7. Hi all am use physics P2, but i want a little optimize. I do not want the real-physics for me is enough just intersection ( because in my game all objects it's sensor. what can be done? For start, i want decrease step in world, how - it's possible (im use typescript and can't change source)? - what more? or better override arcade physics (to add customize circle-separate?) Thanks
  8. Hi guys, I am working on my first Phaser game and have one little question: According to the ( I should be able to do: spriteName.body.moves = false; on a physics enabled sprite in order to allow the mouse input to move it around. But it doesn't seem to work using P2 physics, only arcade. Is there any way to achieve the same effect in P2 or am I doing something wrong? I am doing a pretty similar thing to this example except with P2: Thanks in advance! Gilli
  9. game.physics.p2.setImpactEvents(true); player.body.createGroupCallback(enemyGroundCG, playerCollision, this);this is what i use most of the time but i've heard that using a onBeginContact event is not that much expensive.. to gain some FPS - is it really useful to change the impact handling? does this really matter?
  10. I'm experimenting with P2 physics. I have a game where there are several platforms directly next to each other, with no pixels between them. When I enable P2 physics on these platforms they start bouncing like crazy, as if they're pushing each other out of the way. Already tried applying materials and changing the friction, restitution, kinematic properties but I couldn't solve this. Any way to avoid this from happening?
  11. i am using this function to check if a body that jumped over a ramp (and therefore was set to sensor=true) has left the worldbounds and should be killed. this works for all edges of the world except for the left one.. i can manage to make it work by asking for if (body.x <0) {killit }but if i use the intersects method it will always return true even if x is much smaller than 0 if i console.log the i get: b.Rectangle {x: 0, y: 0, width: 3200, height: 2560, offset: function…} so with the worldbounds it seems everything is ok.
  12. Hello everyone! I'm new to Phaser, so please bear with me if I have missed anything obvious. I am currently creating a pinball game, using the P2 physics option, and have managed to setup the level (static object) and ball (standard circle object) easily enough. I have setup gravity etc. But I am having a lot of problems with the flipper/paddles... - The problem I have is I want to set the flipper to static, but still be able to rotate it using the rotate methods. It doesn't seem like you can do this. Various angle/rotation variables are exposed on the game objects and their bodys, but assigning to these manually has inconsistent effects. So, I then tried setting the mass to 9999 and gravity to 0 so I can apply nice rotation methods... but I still find it slowly moves off its original position as I apply rotateLeft/Right to it. I could just force it back to its original x/y but that seems a bit poo. I'd really love to be able to set it to static, and have a nice rotation 'flick' function. - I have found this guy who made a pinball game, and he is using something called "revolutes". I tried copying his code and adjusting just as much as is necessary so it runs on the latest version of phaser (such as updating his math functions), but this always sets my paddle in a negative x,y position. What really annoys me about his project is that he doesn't seem to be telling the paddles to stay in place (through static or gravity modifiers or any other means that I can spot), they "just do". Does setting up a revolute fix an object into one place? Hopefully someone can follow along and help. Thank you very much in advance.
  13. When I load my entities from a tilemap, some of them are misaligned, for example: (magenta and teal are off a little bit) so I shift these particular objects with x+16, y-4 and I get: (both red) now they're both aligned correctly. My question is, is there some setting I have to change when creating objects? Having these adjustments, and then having to rotate some bodies, is more frustrating than it should be! Nothing seems to line up like it should.
  14. according to the source: convertCollisionObjects gets the properties // properties: json.layers[i].objects[v].properties,but does not do anything with it.. createBody would accept "options" int the 5th field but is using them to create the polygon. var result = body.addPolygon(options, data);so this is not the way to go.. (because addPolygon is only taking 3 special options .. so i instead of using this (real game example:) collisionareas = game.physics.p2.convertCollisionObjects(map,"collisionareas");i am now using this: var collisionareas = []; var layer = "collisionareas" for (var i = 0, len = map.collision[layer].length; i < len; i++) { var object = map.collision[layer][i]; var body = game.physics.p2.createBody(object.x, object.y, 0, true, {} , object.polyline); =; if (body){ collisionareas.push(body);} }then i am able to access the properties set in tiled on my collisonareas (polylines) for (i=0; i<collisionareas.length; i++){ if (collisionareas[i].properties.action == 'ramp'){ collisionareas[i].onBeginContact.add(jumpOnRamp, this); } }now my question is: did i NOT see the obvious way how to do this or is this just not implementet (yet) and.. is this ok to do this or is it dangerous to use something like "" because it is used somewhere else and will cause me troubles later on? thx in advance!
  15. So I have this object in my project that is "conditionally collidable" -- meaning it can only be collided with when it's in a certain frame of animation. See this gif: I only want to be able to collide with the block when it's solid... however, if it stops being solid while I'm on top of it, I want the collision to not happen (and consequently I should fall through it). Currently, this is what's happening: In arcade physics this was pretty simple, just specify a callback for if the collision should happen. I've been fighting with this for a while with p2 and I'm not certain how possible it is.
  16. Hi, I want to follow a sprite with another, but when the first sprite move quickly, the second is shifted. It is visible on the screen and in the logs (x/y position in each iteration of the update function). When the first sprite slow down, the shift is reduced. When it stop, the sprite are at the same position (it’s normal). How to do the positions of the two elements remain the same every time? I have make a live example here :,output Lose focus to do “pause” and watch positions and images. Sorry for my bad english. My example code : var red_ball=null, green_ball=null;var MainState={ preload: function(){ this.load.image('red_ball', ''); this.load.image('green_ball', ''); }, create:function() { this.time.advancedTiming = true; this.physics.startSystem(Phaser.Physics.P2JS); this.physics.p2.setImpactEvents(true); this.physics.p2.defaultRestitution = 0.8; red_ball = this.add.sprite(100, 100, 'red_ball'); this.physics.p2.enable(red_ball); red_ball.enableBody = true; red_ball.physicsBodyType = Phaser.Physics.P2JS; red_ball.scale.set(2); red_ball.body.setCircle(8); red_ball.body.collideWorldBounds = true; red_ball.body.fixedRotation = true; red_ball.anchor.setTo(0.5, 0.5); red_ball.body.angle = 90; red_ball.body.moveForward(3000); green_ball = this.add.sprite(100, 100, 'green_ball'); green_ball.scale.set(2); green_ball.anchor.setTo(0.5, 0.5); }, update: function(){ green_ball.x = red_ball.x; green_ball.y = red_ball.y; }, render: function() { || '--', 2, 14, "#00ff00");'Green ball: x: ' + green_ball.x + ' - y: ' + green_ball.y, 2, 30, "#00ff00");'Red ball: x: ' + red_ball.x + ' - y: ' + red_ball.y, 2, 46, "#00ff00"); }};var game = new Phaser.Game(500, 500, Phaser.CANVAS, 'phaser-example', MainState); Thanks ! Edit: i have update my jsbin link example + a new screenshot to see the shifted:
  17. Hi! How do you build a rectangle shaped (2:1) ship that has two motors? Imagine a ship splitted half (2 x 1:1) and one motor is placed in the center of tail and the other one is in the center of the nose. You can see the ship top-down and rotate and thrust these motors with two virtual joysticks, one for each motor. I'm new to game developing, Phaser and physics engines, but I'm not asking ready code from you. I'm just not sure what are the ingredients that should be used to build the ship and I don't want to hack something ridicilous. I think I should P2 as my physics engine. Then I think I could start by creating a ship's tail as a square and somehow attach a rotatable motor in the center of it. Now, if I played with just this half of the ship, the ship itself wouldn't rotate and the rotated motor just moved the (half of the) ship around the world. However, if I created the nose in the same way and attached the nose to the tail with some magic glue, maybe the whole ship started to act more like a real ship, right? I did some tests with different constraints between two sprites and they locked well with each other using As nothing seemed to work as supposed, I started to play with springs and even though I might be able to hack it together using very stiff springs, it felt so wrong and performance unwise. If that above has any sense: - How do I attach a rotatable motor in center of square? - What is the magic glue that should be used to attach the tail to the front? Now I realized that I don't really understand the point in splitting the ship half. I think it came from my original idea that I wouldn't use separate motors, but just control some force vectors on the both halfs. :] Also, feel free to point me to all the threads that has already answered to similar problem. I did search, but I think I don't know the right search terms. Thanks, cheers.
  18. seiyria

    P2 Woes

    Today I started converting my Arcade Physics game to P2, with the hopes of getting a lot of neat stuff. So far I've only had problems, really. For reference, my code is here (most relevant chunk is GameLevel) and there's a demo here. So I got myself moving around in the world all nice and such, I can jump around, and that's great. Then I went to add platforms, and that was fine. I had platforms that gleefully moved back and forth like little platforms should. Then I wanted to make platforms actually carry me with them, so I found a thread that said to add a collision group to platforms and the player, set a collision, and have a contact material with some friction so the player would be stuck on it. Sure, sounded easy enough. So I did that, and then ... the player no longer stays on the stage. Basically, my code is like this: @game.physics.startSystem Phaser.Physics.P2JS @game.physics.p2.gravity.y = 1000 @game.physics.p2.restitution = 0.2 @game.physics.p2.convertTilemap @map, @tileLayer @game.physics.p2.setBoundsToWorld yes, yes, yes, yes, no @game.physics.p2.setImpactEvents yes = yes @game.playerMaterial = @game.physics.p2.createMaterial 'player' @game.platformMaterial = @game.physics.p2.createMaterial 'platform' @game.physics.p2.createContactMaterial @game.playerMaterial, @game.platformMaterial, {friction: 10, restitution: 0} @players = = player: @game.physics.p2.createCollisionGroup() platform: @game.physics.p2.createCollisionGroup() @game.physics.p2.updateBoundsCollisionGroup() # EDITED IN @game.player = @player = new Player @game, 96,, 'player' @players.add @player @game.physics.p2.enable @player @player.body.fixedRotation = yes @player.body.setMaterial @game.playerMaterial @player.body.setCollisionGroup # POINT 1 @player.body.collides # POINT 2Now here's the fun thing. I fall straight through the floor (as seen in the demo). However, if I remove @player.body.setCollisionGroup (POINT 1) and @player.body.collides (POINT 2) then I get default collision. I was talking with Fishrock and we found out that my collision masks should be correct. the worldBounds has a mask of 2 the player collision group has a mask of 4 the platform collision group has a mask of 8[0].collisionGroup is set to 4[0].collisionMask is set to 10 (which is 2 | 8, or worldBounds | platform) I've also tried flat out removing POINT 1 and then adding[0].collisionMask |= 1 (which makes it collide with the terrain AND world bounds correctly, except I do _not_ collide with platforms now) I've also tried a bunch of other things, but I can't seem to find an obvious solution.
  19. I just started using Phaser yesterday so keep that in mind ... I got my very basic set up running using the arcade physics. right now it's just a character that runs across the screen and jumps over things, pretty basic. But I wanted it to be able to run up a hill at an angle so I figure this means I need p2 (if this is not the case, please let me know so I can stop trying to figure this out!). I tried just converting what I have to P2 but it's entirely messed up. The gravity is moving REALLY slowly no matter how I adjust the number, one of my tilesprites is upside down, the placement of objects is off, and nothing will collide. I've tried copying the examples I found in the examples directory, but nothing seems to help. Are there any tutorials or examples of this kind of game using P2? I looked through the tutorial list in the sticky thread but didn't find anything. There are ton using Arcade physics, but it seems like the P2 stuff is mostly floating around in space hitting things. Any help would be much appreciated!
  20. Hi! For several months, I have this problem and have not been able to fix it. I made a post about it while communicating my problem. I use physical P2. When the player touches a wall or jump over the side it gets stuck and does not fall as it should. Some of my code: // map ='level1_1');'sand');,; this.layer ='Sand'); // this.layer.debug = true; this.layer.resizeWorld(); this.layer_tiles =, this.layer); // materials & collision groups this.playerMaterial ='player'); this.layerMaterial ='layer'); this.enemyMaterial ='enemy'); this.playerCG =; this.enemyCG =; this.layerCG =; function setupLayer(layer_tiles, theGame) { var layerLength = layer_tiles.length; for (var i = 0; i < layerLength; i++) { layer_tiles[i].setCollisionGroup(theGame.layerCG); layer_tiles[i].collides([theGame.playerCG, theGame.enemyCG]); layer_tiles[i].setMaterial(theGame.layerMaterial); } } setupLayer(this.layer_tiles, this); // player; player.scale.setTo(0.5, 0.5); player.body.setZeroDamping(); player.body.fixedRotation = true; player.anchor.setTo(0.5, 0.5); player.body.collideWorldBounds = true; player.body.setCircle(15); player.body.setCollisionGroup(this.playerCG); player.body.setMaterial(this.playerMaterial); player.body.collides([this.layerCG, this.enemyCG]); player.body.createGroupCallback(this.enemyCG, collisions.collisionEnemy, this); player.body.mass = 50; Can anybody help me? A greeting.
  21. Hi, I finally decided to give a try to P2 after using Arcade a lot. So I started my project with Phaser 2.0.7, and was trying to build a really simple test with just 1 box falling on top of another one. But it appears in all the examples that without configuration the world should automatically have bounds, which is not the case in the 2.0.7 build. However, when I passed to 2.0.6, just by changing the phaser version, with the same code, the world has bounds. my code : //create functiongame.stage.backgroundColor = '#00ffff';game.physics.startSystem(Phaser.Physics.P2JS);this.ball1 = game.add.sprite(165, 300, 'ball1');this.ball2 = game.add.sprite(150, 400, 'ball2');game.physics.p2.enable([this.ball1, this.ball2], true);// update function this.ball1.body.velocity.y = 50;Sorry if it's documented somewhere, but couldn't find anything on this subject. Thanks in advance for helping.
  22. first i create a mousebody... mouseBody = game.add.sprite(0, 0, '', 0);game.physics.p2.enable(mouseBody,true);mouseBody.body.setCircle(2);[0].sensor = true;this one is kept at the mouse position via the update loop with this lines: mouseBody.body.x =;mouseBody.body.y =;then i check if i hit a "tux" with a mouseclick and if so i create a connection between the mousebody and my tux body.. game.physics.p2.createSpring(hitobjectbody, mouseBody, 1,20,1);this works great but sometimes the spring created doesn't follow the configuration it is definitely not 1,20,1 it is more like 30,40,1 i just can't find out why this is happening but it's driving me nuts.. i clear all springs with this lines: var allSprings = game.physics.p2.getSprings(); if (allSprings.length > 0){ game.physics.p2.removeSpring(allSprings); }there is something wrong with remoeSpring because it only takes an array.. no single spring (i already posted about that) thx! (in the attachment you can see that the mousebody keeps it's distance to the tux.. it is exactly below the mouse pointer but the tux can never be there even if the "restLength" of the spring should be 1px as configured.. )
  23. Hi, I use P2 physics. What is the best way to make a sprite catching another when collide ? In other words how can I "cancel" the collision movement between 2 sprites ? After that, the 2 sprites are "walking" together till a key is down. Thanks in advance. nicofisch5
  24. (Apologies I'm sure this has been asked before, but I cant seem to find it) P2 physics. I'm using the onBeginContact method for checking when my object impacts another. I want to play a sound when they contact, but only if its of reasonable force. For very slow/minor impacts I don't want a sound to play. Is it possible to get the force of the impact from P2, perhaps via the contactEquation? I'm playing around with checking velocities, but its a bit of a hack.
  25. Hi guys. How I can get Sprite object from bodyA or ShapeA ? collisionHandler: function (bodyA, bodyB, shapeA, shapeB, contactEquations)