Hi all again…
I´m experimenting how to activate an elevator…
first of all i have here my code:
var elevator_object : Transform;
var player1 : Transform;
var speed_value = 0.4;
var go_up = false;
function Update(){
if (go_up){
elevator_object.transform.Translate(Vector3.up * Time.deltaTime * speed_value);
player1.transform.Translate(Vector3.up * Time.deltaTime * speed_value);}}
function OnTriggerEnter(other : Collider){
if (Input.GetButtonDown("Jump")){
go_up = true;}}
The problem is in OnTriggerEnter() function, if i delete the event condition for pressing Jump button, the elevator works fine, there is a trigger empty that activates it, then if i go into the elevator, it takes me to up with no problem…
But as you can see, the elevators does not work like sensors (at least in this world), we must to press a button to go the floor we want… lets say the button is “Jump”, that’s all… Just want to do the player go into the elevator and when user press “Jump” (or space) button, the elevator activates…
the script above is like i was thinking but does not work… do you have a tip to make it?
thank you…