- Home /
Help - I need a simple reset/teleport function for my ArchViz project!
I'm currently making a first-person architectural visualization "game" of a house I'm doing (i.e. no weapons or hud, only the map and directional keys) for a class. The intention is to have it running on a laptop during the final project presentation, such that visitors can come up to it and explore the map ingame. Problem is that I'd like the visitors to start the tour at an external location, and not, say, inside a restroom, because the last visitor stopped there.
Here's the question: How can I script a keystroke such that pressing it immediately teleports you back to a predefined start point? Or better yet, is it possible to have a, say, 30 second timeout timer, so that it teleports back after 30 seconds of idling? It's a lot to ask for, and I have virtually no scripting experience, but thanks.
Answer by LasseBmann · Oct 13, 2011 at 01:36 PM
Well, there is a teleport script you can modify on unifycommunity.com^^ But basically what you can do is something along the lines of this: (javascript)
var ResetPoint : GameObject;
function Update (){
if (Input.GetButton("Reset")){
transform.position = ResetPoint.transform.position;
}
}
You create an empty javascript, paste this into it, attach the script to your player object, then create an empty gameobject where you want it to teleport to, and then drag the gameobject into the ResetPoint variable - and then you goto and setup a new input, named "Reset", and you should be good to go:)
Your answer
Follow this Question
Related Questions
Resetting a timer after game over 1 Answer
Reset a Timer made with .fillAmount 1 Answer
Why is the timer increasing after every reset? 3 Answers
How to reset the scaling after 1second 1 Answer
restart when dead 2 Answers