[Solved]FPS elevator

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 :slight_smile: the youtube user was called cannedmushrooms just in case someone remembers the video :slight_smile:

Maybe this helps:

http://www.unifycommunity.com/wiki/index.php?title=PhysicsFPSWalker

That script does work but it doesn’t allow me to look left and right :stuck_out_tongue:

This may help:

Thanks for the link, that is the video i followed :smile: weird thing is i couldn’t find it on youtube, i’ll have a look at it tomorrow and see where i get with it all :smile:

I had a look through the videos didn’t need to change my scripts very much and it all works now with the normal controller :slight_smile: thanks again for the link

What. Did. You. Change?!