2.5d Ladder or climb functions

I have searched all over google and youtube trying to find some sort of tutorial on 2.5d ladders. I cant find anything!? So I created a model, which would be the ladder, and I created a second box larger with no mesh render that collides with my character. The box is called “LadderClimb” The ladderModel is more in the background just for appearance. I then put together this script

LaderClimber.js

var prefabTarget : Transform;

function OnTriggerEnter(theObject:Collider){
if(theObject.gameObject.name==“LadderClimb”){
prefabTarget.transform.position.y += 500;
Debug.Log(“found ladder”);
}
}

I attatched the script to my character and then set the ladderClimb (with no mesh rendering) to a prefab and linked that prefab to this script on my characters inspector menu. I know I do not have a button press to transform the character currently. I just wanted the ladder to move my character in proof it worked first. It does not. Any help would be greatly appreciated. Example scripts for 2.5d or anything. I will create a youtube tutorial if I can get this working. It is hard to believe no one has created tutorials in 2.5d for this.

Thanks Again!

Not an expert, but:

function OnTriggerEnter(theObject:Collider)
{
  if(theObject.gameObject.name=="LadderClimb")
  {
    prefabTarget.transform.position.y += 500;
    Debug.Log("found ladder");
  }
}

You don’t create a reference to the prefabTarget in this code. Do you do it elsewhere? If not, what about:

function OnTriggerEnter(theObject:Collider)
{
  if(theObject.gameObject.name=="LadderClimb")
  {
    theObject.transform.position.y += 500;
    Debug.Log("found ladder");
  }
}

EDIT: Oh nvm, I just realised this code is likely on your Player, not your ladder, right? These are not the droids you’re looking for!

Is this 2.5D via 3D or 2D?

Just wondering why 2.5D tutorials need to be created, when in 3D they’re identical to 3D scripts, or perhaps tile based 3d.

2d via 3d with restricted axis movements.

I got it working in a slightly different way. I don’t know where your problem is, so here’s some thoughts:

All objects zeroed in the z-axis?
Is Trigger checked on LadderClimb?
Tried adding a Configurable Joint to the player so that he can’t move in the z-axis?

Here was my OnTriggerEnter:

  void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == "LadderClimb")
        {
            this.transform.position += Vector3.up * 5;
        }
    }

Man that definitely works! thank you so much. this would be a great script start for springboards as well. now let me ask you. if we turned that down to say .3 or even 1…how could we make it “climb” up rather than teleport upwards? and not only on collide but when say the up arrow is key pressed.

thanks again so much for a great start!