I’m having issues with getting a working elevator, i have been using the FPS controller provided with unity.
I’ve tried using the one in the 2D platformer tutorial and it doesn’t even collide with the FPS controller, i have also tried to use an elevator that i created when following a tutorial on youtube, sometimes i can get all the way to the top and then i fall through other times i fall through about half way and on the occasion it works but it’s very annoying.
It works along the lines of.
You walk through an invisible trigger parenting you with the elevator i think.
You then hit the invisible trigger on the elevator to tell it to go up to the set Y coordinate.
Once at the top you walk into one last invisible trigger unparenting you with the elevator i think.
First script
var Player: Transform;
var Elevator: Transform;
var to: Vector3;
var from: Vector3;
var elespeed: int=5;
var boolswitch: updown;
function OnTriggerStay(other: Collider) {
boolswitch = FindObjectOfType (updown);
if (boolswitch.eleswitch ==1) {
if (Elevator.transform.position.y < from.y) {
print (boolswitch.eleswitch);
Player.parent = Elevator;
Elevator.transform.Translate(Vector3.up*Time.deltaTime*elespeed);
}
}
}
Second Script
static var eleswitch: int;
var trigger: int=1;
var Player: Transform;
function OnTriggerStay(other: Collider) {
eleswitch =trigger;
Player.parent =null;
}
I hope someone can make sense of it all
the youtube user was called cannedmushrooms just in case someone remembers the video ![]()