Hi,
I don’t know if this has been answered here before but I would like to know how to move a character in front of a collider and be able to jump and be on top of the said collider. With the example below I want my character to move in front of the house but be able to
a) walk up the stairs
b) just jump on the balcony? Help?
_
_
_
One way you can do this is by setting the collider to IsTrigger, and setting it to a non-trigger collider if the player is on top of it. To detect whether the player is above the collider, use a raycast that points downward, and turn off IsTrigger for any colliders that it hits. For example:
void Update()
{
ActivatePlatformGround();
}
void ActivatePlatformGround()
{
var hitInfo = Physics2D.Raycast(transform.position, Vector2.down);
hitInfo.collider.isTrigger = false;
}
@JeremyxLefebvre