Activating plane if Player above, deactivate if below

I am making a 2D platformer (it’s actually 3D, but with an orthographic camera)and I would like to have jump through platforms. I have accomplished this somewhat by putting the sprite of the platform behind the player, but with a upwards-facing plane at the top of the sprite, at the player’s z-position. However, the player sometimes doesn’t go through the platform when he attempts to jump through it, and instead is bounced back, or is jerked up unnaturally. Does anyone have a script to make it so the collision plane is deactivated when the player is below it, and activated when he is above it?

I am using a modified First Person Controller as the player. I know the way I’m doing things isn’t the most effective, but it makes the most sense to me.

Also, if possible, I would like to have this feature working for sloped planes as well.

Note asking for a script is a good way of getting your question rejected, closed, or at least a thumbs down. It is a hot button on UA, and it is best to avoid that language.

Assuming you are using Unity’s Plane game object, you can get what you want by:

  • Getting a refrence to the position at the base of the character. An easy way to do this is to put an empty game object right at the base of the character and make it a child of the character. Give empty game object a unique name like ‘PlayerBase’. Or a lot of games makers model their characters so the pivot is at the base.
  • Convert that position to a local position for each plane every frame. If the ‘y’ of that position is positive, then the position will be ‘above’ the Plane. Note that is a local above, so even if the plane is at an angle or even upside down, it will work. Note if the character is not parallel to the plane normal there is a possibility with an angled plane for a ‘corner’ of the mesh to intersect the plane even if the character’s base is ‘above’ the plane. This can be solved (if necessary) by putting multiple empty game object at the base (front and back for 2D, four sides for 3D) and testing all. A bit of untested example code:

#pragma strict

private var playerBase : Transform;
private var doesCollisions = true;

function Start() {
    playerBase = GameObject.Find("PlayerBase");

function Update() {
    var localPos = Transform.InverseTransformPoint(playerBase.position);
    if (localPos.y > 0.0 && !doesCollisions) {
       collider.enabled = true;
       doesCollisions = true;
    if (localPos.y <= 0.0 && doesCollisions) {
        collider.enabled = false;
        doesCollisions = false;