Search Unity

Sticky Platform

Discussion in '2D' started by LeeDenbigh, Oct 6, 2015.

  1. LeeDenbigh

    LeeDenbigh

    Joined:
    Jul 7, 2014
    Posts:
    48
    Hi, can someone help me out with a problem that I can't seem to fathom out. I have a game object (player) that has a rigidbody2D and a circle collider attached. I want the player object to stick to a platform that is over it's head when jumped into. How would I go about that simply, and when the Colliders aren't touching the player just falls back to the ground?
     
  2. LeeDenbigh

    LeeDenbigh

    Joined:
    Jul 7, 2014
    Posts:
    48
  3. Prototypetheta

    Prototypetheta

    Joined:
    May 7, 2015
    Posts:
    122
    Add a head check, then tell it to kill vertical motion whenever it collides with said platform. Then you just need to make it so you can dismount that platform (maybe only have it check while a certain key is held down).

    You could do it with a new collider or good old raycasting.
     
    theANMATOR2b likes this.