Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnCollisionEnter2D(Collision2D col) {
- if (standingOn != null) {
- foreach (ContactPoint2D contact in col.contacts) {
- print (contact.normal.normalized.x);
- if (contact.normal.normalized.x > .999 || contact.normal.normalized.x < .999) {
- if (Mathf.Abs (col.gameObject.transform.position.y - standingOn.gameObject.transform.position.y) < .1 && standingOn != col.gameObject) {
- RB.AddForce(Vector2.up * 50);
- }
- }
- }
- }
- standingOn = col.gameObject;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement