- Home /
How could I create an endless stairs effect?
I am looking to create an endless stairs effect similar to that in Super Mario 64. So the player would go up the stairs, and no matter how far they go, if they turn around they will be at the bottom again. http://www.youtube.com/watch?v=B-udfiFZcko This video will show you what I'm on about, but it's a 10 hour long video... But yeah could someone please tell me how I could create this effect?
Answer by MadJohny · Jul 22, 2013 at 03:33 PM
Maybe use an invisible wall, and make the stairs move down in the y and z axis, and maybe when it reaches a certain point it goes back up, it would need to be really smooth tho to make it look good
Answer by Shaolin-Dave · May 16, 2016 at 05:17 PM
Create a prefab for a section of stairs, and a trigger that will be placed a little bit up the stairs. Have the bottom of the stairs in a separate GameObject.
When the player hits the trigger, have it spawn a copy of the stairs prefab just a little beyond the stairs that are currently available, and move the trigger forward the same distance as the stairs length.
At the same time, delete the section of the stairs at the bottom, and move the position of the stairs bottom to that position.
Alternatively you could just have two long sections of stairs and have the bottom one move past the top one, rather than constantly spawn new ones. You could even make two triggers as part of the stair prefabs rather than stand-alone. I suggest against that if the player has the ability to look down the stairs while walking up them backwards.
If they do have the ability to walk up the stairs backwards and view the bottom, I'd make some tweaks to the trigger. Have it create the new section of stairs above the existing all the time, but only delete the lowest section and move the bottom when they're facing forward. This way, they'll think they're making progress as they're walking away from the bottom, but it'll still be infinite and the bottom of the stairs will catch up to them the moment they turn around.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
photocamera flash 1 Answer
Destroy GameObject A or B 1 Answer
Cube terrain with perlin noise 1 Answer
What is wrong with this script? 2 Answers