protected bool ChipmunkPreSolve_ball_oneway(ChipmunkArbiter arbiter) { if (arbiter.GetNormal(0).y > -0.7f) { arbiter.Ignore(); return(false); } return(true); }
protected bool ChipmunkBegin_player_bumpable(ChipmunkArbiter arbiter) { if (arbiter.GetNormal(0).y > 0.9f) { ChipmunkShape player, bonusBlock; arbiter.GetShapes(out player, out bonusBlock); bonusBlock.SendMessage("Bump"); } return(true); }
public static bool isCeiling(ChipmunkArbiter arbiter) { /// The collision normal is the direction of the surfaces where the two objects collided. /// Keep in mind that the normal points out of the first object and into the second. /// If you switch the order of your collision types in the method name, it will flip the normal around. if (-arbiter.GetNormal(0).y < -COS_45) { return(true); } return(false); }
public static bool isGrounded(ChipmunkArbiter arbiter) { /// The collision normal is the direction of the surfaces where the two objects collided. /// Keep in mind that the normal points out of the first object and into the second. /// If you switch the order of your collision types in the method name, it will flip the normal around. // if normal.y is near to 1 it means it's a hit from above if (Mathf.Abs(arbiter.GetNormal(0).y) > COS_45) { return(true); } return(false); }
protected bool ChipmunkBegin_player_jumpshroom(ChipmunkArbiter arbiter) { ChipmunkShape player, shroom; arbiter.GetShapes(out player, out shroom); if (arbiter.GetNormal(0).y < -0.9f) { ChipmunkBody body = player.GetComponent <ChipmunkBody>(); body.velocity = new Vector2(body.velocity.x, 50f); return(false); } else { return(true); } }
protected bool ChipmunkPreSolve_player_oneway(ChipmunkArbiter arbiter) { // If we're pressing the down arrow key. if (Input.GetAxis("Vertical") < -0.5f) { // Fall through the floor arbiter.Ignore(); return(false); } if (arbiter.GetNormal(0).y > -0.7f) { arbiter.Ignore(); return(false); } return(true); }