Sign in to follow this  
valueerror

p2 body seems to be touchingDown but up in the air next to a wall

Recommended Posts

the problem can be seen here (as always ;-) ) http://test.xapient.net/phaser/ALL/

 

i apply a frictionless material so it doesn't stick to the wall... 

 

this works most of the time..

but if you push the button to move into the direction of the wall in the air again.. it will eventually stick to the wall ..  (it does that even if i set every contactmaterial to friction=0 )

i think it shouldn't because there is no friction at all..

 

 

 

this is maybe related to another post right here: http://www.html5gamedevs.com/topic/4807-physics-bodies-stick-when-colliding-from-the-side/

 

i am trying to get something like the arcade "touchingDown" with this function (thx to rich's lab experiment)

 

function touchingDown(player){    var yAxis = p2.vec2.fromValues(0,1);    var result = false;    for(var i=0; i<game.physics.p2.world.narrowphase.contactEquations.length; i++){    var c = game.physics.p2.world.narrowphase.contactEquations[i];        if(c.bi === player.body.data || c.bj === player.body.data){            var d = p2.vec2.dot(c.ni,yAxis); // Normal dot Y-axis            if(c.bi === player.body.data) d *= -1;            if(d > 0.4) result = true;        }    }    return result;}

and it showed me that (if you change (d>0.4) to (d>0) )  touchingDown is always true when the player sticks .. i honestly think that this is something to be solved at the "phaser side"   - at least i did't find a 'cure' yet

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.