Advertisement
Ineentho

Untitled

Jun 16th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. void OnCollisionEnter2D(Collision2D col) {
  2.         if (standingOn != null) {
  3.             foreach (ContactPoint2D contact in col.contacts) {
  4.                 print (contact.normal.normalized.x);
  5.                 if (contact.normal.normalized.x > .999 || contact.normal.normalized.x < .999) {
  6.                     if (Mathf.Abs (col.gameObject.transform.position.y - standingOn.gameObject.transform.position.y) < .1 && standingOn != col.gameObject) {
  7.                         RB.AddForce(Vector2.up * 50);
  8.                     }
  9.                 }
  10.             }
  11.         }
  12.         standingOn = col.gameObject;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement