Hello, i'm trying to make a teleportation script in unity with c# i have already made it so when they go through the teleport they end up at a different teleport with a sound i was wondering how i would make it so when you go through the teleport you end up just in front of the teleport not on it.
heres the code that teleport's me:
IEnumerator OnTriggerEnter(Collider other) {
if(other.tag == ("teleport 1")) {
audio.PlayOneShot(teleportSound);
yield return new WaitForSeconds(0.8f);
transform.position = SpawnPoint1.transform.position;
yield return new WaitForSeconds(1.5f);
Any help will be appreciated.
float amount = 10.0F;
transform.position = SpawnPoint1.transform.position + SpawnPoint1.transform.forward * amount;
depending on the orientation of your SpawnPoint, you may have to throw a negative in there or do a .right instead of .forward
system
January 18, 2012, 6:42am
4
yer its jst what comes up iv tried so many vids on youtube and copyed but it still neva works can you help me out
system
January 12, 2012, 7:06am
3
hey guys i need help 2 this is all i have for a teleport C# script please help me
using UnityEngine;
using System.Collections;
public class teleport : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}