# \[Solved\]FPS elevator

**URL:** https://discussions.unity.com/t/solved-fps-elevator/417794
**Category:** Scripting
**Tags:** Scripting
**Created:** [July 10, 2010, 10:34pm UTC](https://discussions.unity.com/t/solved-fps-elevator/417794 "2010-07-10T22:34:28Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![anon20000101](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@anon20000101](https://discussions.unity.com/u/anon20000101)
#### Post date: [July 10, 2010, 10:34pm UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/1 "2010-07-10T22:34:28Z")

</div>

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

```auto
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

```auto
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 🙂

---

<div class="post-metadata">

### Author: ![CaptainKiyaku](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/captainkiyaku/32/521336_2.png) [@CaptainKiyaku](https://discussions.unity.com/u/CaptainKiyaku)
#### Post date: [July 10, 2010, 10:38pm UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/2 "2010-07-10T22:38:32Z")

</div>

Maybe this helps:

[http://www.unifycommunity.com/wiki/index.php?title=PhysicsFPSWalker](http://www.unifycommunity.com/wiki/index.php?title=PhysicsFPSWalker)

---

<div class="post-metadata">

### Author: ![anon20000101](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@anon20000101](https://discussions.unity.com/u/anon20000101)
#### Post date: [July 10, 2010, 11:42pm UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/3 "2010-07-10T23:42:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![anon\_77571586](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@anon\_77571586](https://discussions.unity.com/u/anon_77571586)
#### Post date: [July 11, 2010, 2:36am UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/4 "2010-07-11T02:36:44Z")

</div>

This may help:

> **[burgzergarcade.com](http://ww38.burgzergarcade.com/tutorials/javascript/0036-unityproject6-elevator-script1mov)**
>
> This domain may be for sale!

---

<div class="post-metadata">

### Author: ![anon20000101](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@anon20000101](https://discussions.unity.com/u/anon20000101)
#### Post date: [July 11, 2010, 2:59am UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/5 "2010-07-11T02:59:47Z")

</div>

Thanks for the link, that is the video i followed 😄 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 😄

---

<div class="post-metadata">

### Author: ![anon20000101](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@anon20000101](https://discussions.unity.com/u/anon20000101)
#### Post date: [July 11, 2010, 8:13pm UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/6 "2010-07-11T20:13:59Z")

</div>

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 🙂 thanks again for the link

---

<div class="post-metadata">

### Author: ![M1n3cr4ftrul35](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@M1n3cr4ftrul35](https://discussions.unity.com/u/M1n3cr4ftrul35)
#### Post date: [October 27, 2013, 4:27am UTC](https://discussions.unity.com/t/solved-fps-elevator/417794/7 "2013-10-27T04:27:11Z")

</div>

> [@system](#):
>
> 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 🙂 thanks again for the link

What. Did. You. Change?!
