Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Franois · Feb 21, 2011 at 03:27 PM · buttontriggerteleport

Teleport when clicking a button

Hi everyone !

Here is my problem :)

I want to setup a bunch of buttons on my map. Each triggered buttons will teleport my player (FPS style) into different areas of the map. How can I setup that (I'm a beginner in coding, but understand the fonctions)

Thanks !

Franois

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by orange · Feb 21, 2011 at 03:35 PM

hi,

i hope my idea will help you.

i would try to get the collision event, before you should tagging your trigger with a new tag. Then i think its possible to get the tag while collide and then you can teleport you fps the the defined position.

i hope it helps you

best regars

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Franois · Feb 21, 2011 at 03:51 PM

Actually, I can do something like loading a different map to that. Doesn't to be in the actual map (you cannot navigate between them).

I found those exemples:

http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.html?from=MonoBehaviour

and this one:

http://unity3d.com/support/documentation/ScriptReference/Object.DontDestroyOnLoad.html?from=Application

I think that will do it !

Thanks by the way.

Franois

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by orange · Feb 21, 2011 at 04:03 PM

i thinked you translated the fps controller but ok, maybe change the scene like main menu -> start game or something like that

best regards

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Nynex71 · Feb 21, 2011 at 04:56 PM

Attach this to your player... This is written in c# so if you dont know it and are used to javascripting i apologize but here it is and its quite easy to understand so you should be able to easily make many different teleporting points. I may edit this later on if you comment back asking for this to be changed to make it more suitable for you.

using UnityEngine; using System.Collections;

public class Teleport : MonoBehaviour {

 public Transform Teleport1;

 // Update is called once per frame
 void Update () {

 }

 void OnGUI() {
     if(GUI.Button(new Rect(10, 50, 75, 25), "Teleport1")) {
         transform.position = Teleport1.position;
     }
 }

}

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nynex71 · Feb 22, 2011 at 03:03 AM 0
Share

Create an empty game object... rename it to teleport1 or something place it where you want to teleport to and than drag it onto the variable... Debug or Export your game (i recommend debugging) and try it out...

avatar image toby · Jul 29, 2011 at 09:07 AM 0
Share

bro, do u have any idea for the script (above) to gravity up the FPS and fly to the destination (Teleport1)....i mean the FPS can do this at any coordinate..

avatar image
0

Answer by Franois · Feb 24, 2011 at 01:00 PM

Ok, thanks !

I will try that and see if I've got any problems... (well, I don't know why, but I'm pretty sure I will have problems !)

Cheers, Franois

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image biohazard · Jul 29, 2011 at 09:08 AM 0
Share

for the heck of it...there is a button called "add new comment"...

what do we have to do, make that button ten times bigger and flash in red?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Button back not clickable after rotation animation 1 Answer

Teleport to a random height 1 Answer

Do 2 Triggers Collide? 1 Answer

Activating One Part of An Animation 2 Answers

Changing the sliding door script in Angry Bots to open at a button press. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges