ey i really dont know what i do wrong…
i want my ladder to be able to climb on it.
i tried a trigger that changes the gravity but doesnt works how i want it.
i tried a trigger that auto pulse me up.
but the real thing i want is when i am in the trigger my controls changes and when i press up or down i will climb on it.
but not inmediatly till the end because i want to be able the hang still on it.
can someone maybe help me ?
Have a bool that sets itself to true when the player enters the ladder’s trigger. Then in Update() check if the bool is true and if it is, have your Input.GetAxis(“Vertical”) move the character up and down inside of forward and backward.
ey i got my boolean now : private var LadderControl : boolean = false;
and how it have to work :
and how i when i wanted to work:
what am i doing wrong ? can you please help me ?
i think its in the last part…
hello ?
Without testing:
var moveSpeed : float = 3.0; // how fast we can move in units per second
private var onLadder : boolean = false; // are we on a ladder?
function Update() {
if (Input.GetAxis("Vertical")) {
if (onLadder) {
gameObject.transform.translate(Vector3.up * (Time.deltaTime * moveSpeed), Space.World);
}
else {
gameObject.transform.translate(Vector3.forward * (Time.deltaTime * moveSpeed));
}
}
}
function OnTriggerEnter (col : collider) {
if (col.gameObject.tag == "Ladder") {
onLadder = true;
}
}
function OnTriggerExit(col : collider) {
if (col.gameObject.tag == "Ladder") {
onLadder = false;
}
}
That should get you close at the very least.
doesnt work either…
when does he knows the boolean is true ?
You might have to do a bit of work yourself.
but you just wrote what i already have tried.
i know it was helpless
i was already that far i only need just that piece you have kept out of it…
please somebody help me with the last piece.
@nalim: in your code, you are checking the name of the collider object, while KelsoMRK is checking the tag. Could that be what is causing the problem? If so, you just need to add a “Ladder” tag to the ladder or else change the code so it checks the name instead.
no because i already had him tagged Ladder
so that isnt it