# swissnetizen

Members

49

• Rank

• Gender
Male

swissnetizen

## Recent Profile Visitors

1120 profile views

1. ## p2 Bug? Sprite falls through world if rotated

I've found a work around; instead of setting the slope to -45 I set it to 2pi - 7×-0.7853981633974483 (≈-1.502212856217862) which mostly works, but can still be glitched out: http://g.recordit.co/juY6h6aUkT.gif Does anyone know why this works?
2. ## p2 Bug? Sprite falls through world if rotated

(http://g.recordit.co/o5HlkT1d5S.gif) Hi, so my setup involves two hills, where the player is rotated to match the slope angle. The first hill rotates the player to an angle of -45° and the second rotates it to 45°. The problem is that once the second rotates the player, the player can just fall through the bodies. My code for the hills is almost identical. (have a different triangle and angle). I think this might be a bug in p2. Any thoughts? EDIT: I've added a second example: http://g.recordit.co/FLgBsRxbeI.gif In this example we can see that the sprites will slide down the first hill, but upon touching the second they will fall through the wold.
3. ## P2 moving platform

Hi! I've been trying to make a moving platform where the player (and other sprites) can ride upon. I tried using something similar to this example (http://jsfiddle.net/pandavigoureux29/zphsz7kp/) to no avail. I've also tried using a contact material and messed with the various friction properties to no avail. I've seen a gravity based solution that ramps up gravity 100x, but I can't use that because of how my game works. Thanks in advance for your help!
4. ## How to check if on Floor using P2?

For future reference, this is how to detect if the entity is on the floor (I think): var checkIfCanJump = function() { var c, d, i, result, yAxis; yAxis = p2.vec2.fromValues(0, 1); result = false; i = 0; while (i < game.physics.p2.world.narrowphase.contactEquations.length) { c = game.physics.p2.world.narrowphase.contactEquations[i]; if (c.bodyA === player.body.data || c.bodyB === player.body.data) { d = p2.vec2.dot(c.normalA, yAxis); if (c.bodyA === player.body.data) { d *= -1; } if (d > 0.5) { result = true; } } i++; } return result; }; from: http://phaser.io/examples/v2/p2-physics/tilemap-gravity
5. ## How to check if on Floor using P2?

I don't think you understood. I want to check if it's on a floor outside of an event handler. The example uses event handler with collision groups that's not what I want to do
6. ## How to check if on Floor using P2?

Hey, So I need to check whether a sprite is on the floor using P2 physics. Basically something like Arcade.onFloor() but for P2 physics.

Thanks! that was it!

That makes sense, how would you do that?

Just updated to Phaser 2.4.6, no improvement.

The issue is that it doesn't show; yet when you check game.world.children it says that the text exists.

I do change states, but I think it's caused by the tilemap because I've checked diffs of the source before and after and tilemaps was the major change (there was a minor tweak to some keyboard events).