x


I need to teleport a FPS chara controller

How to teleport a character? I mean the player from a scene 1 to a Scene 2?

And is it possible to link the triggers,variables or switchs between two scenes?

Thank you.

more ▼

asked Feb 12 '11 at 08:17 PM

Moltvatch gravatar image

Moltvatch
32 10 10 11

(comments are locked)
10|3000 characters needed characters left

2 answers: sort oldest

And is it possible to link the triggers,variables or switchs between two scenes?

Of course; very rarely is it 'impossible' to do something of that sort.

To 'teleport' the character from one scene to another, you'll want to use Application.LoadLevel() to load the new scene, and then (if necessary) position the character at the appropriate location in the scene.

As for data that persists between levels, here are three options:

  1. Static member variables
  2. DontDestroyOnLoad()
  3. PlayerPrefs
more ▼

answered Feb 12 '11 at 10:02 PM

Jesse Anders gravatar image

Jesse Anders
7.3k 7 17 48

listen I've made a script here but it doesnt work here is it :

function OnTriggerEnter(other : Collider) { if (Input.GetKeyDown ("e")) Application.LoadLevel (1); }

function Awake () { DontDestroyOnLoad (transform.gameObject); transform.position = Vector3(71,79,-456); }

Is there anyway you can tell me what's wrong with it? or even tell me what script i should use?

Feb 15 '11 at 12:30 PM Moltvatch

You don't want to use GetKeyDown() (or the Input class in general) in OnTriggerEnter(), I don't think. One way or another, you'll probably need to rearrange your logic so that the collision is detected in OnTriggerEnter(), but checking for input happens in Update().

Feb 15 '11 at 01:29 PM Jesse Anders
(comments are locked)
10|3000 characters needed characters left

Ok thank you then!

more ▼

answered Feb 12 '11 at 10:45 PM

Moltvatch gravatar image

Moltvatch
32 10 10 11

please, this is not an answer, use comments to comment or thanks for something, answer as the name says is to answer a question not to thank for something.

Feb 12 '11 at 10:52 PM Uriel_96

I'll call you when I need some idiot to make me advices.

Feb 12 '11 at 11:19 PM Moltvatch

Thanks for the thank you :) But please, don't be rude to your fellow forum members. Posting a comment or reply as an answer is a common mistake - no biggie. Uriel was just making you aware of how the forum works for next time.

Feb 13 '11 at 02:04 AM Jesse Anders
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1172
x1043
x804
x717
x90

asked: Feb 12 '11 at 08:17 PM

Seen: 1219 times

Last Updated: Feb 12 '11 at 08:17 PM