This is the script i made without really thinking. I’ve never actually made a script on my own without anybodys help but i want to be able to. So this is the script i made randomly to show the basic idea of what i want to happen
var canClimb : false;
function Update () {
if (canClimb = true) && (Input.GetButtonDown(KeyCode.W)) {
transform.Translate (Vector3(0,0,1) * Time.deltaTime*speed);
}
if (canClimb = true) && (Input.GetButtonDown(KeyCode.S)) {
transform.Translate (Vector3(0,0,-1) * Time.deltaTime*speed);
}
function OnTriggerEnter () {
canClimb = true;
}
function OnTriggerExit () {
canClimb = false;
}
Okay, so i want it so that when a player enters a collider the letter w makes you go up and the letter s makes you go down. What i need to do is make it actually work. Like i know this would never work because unity doesnt know what to move up, but i dont know how to tell it what to move up. I know you can use tags but i dont know how to do that. So tell me if this script is crap and useless, or help me fix it mabye? I just want to have a ladder basically. Its first person so no need for animation.