Question by
codybrenner103 · Oct 25, 2017 at 07:19 PM ·
gameobjectprefabplayerglitchteleport
Object Teleports but returns back to original location super fast
Hello, after several tries i found some help here http://answers.unity3d.com/questions/1191795/teleport-script-2.html this enabled me to teleport a game object with a tag.
When the teleport happens I get teleported but return back to original position super quick.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class doorenter : MonoBehaviour {
public Transform Destination; // Gameobject where they will be teleported to
public string TagList = "|Player|Boss|Friendly|"; // List of all tags that can teleport
// Use this for initialization
void Start()
{
// As needed
}
// Update is called once per frame
void Update()
{
// As needed
}
public void OnTriggerEnter(Collider other)
{
// If the tag of the colliding object is allowed to teleport
if (TagList.Contains(string.Format("|{0}|", other.tag)))
{
// Update other objects position and rotation
other.transform.position = Destination.transform.position;
other.transform.rotation = Destination.transform.rotation;
}
}
}
Comment
Answer by Cuttlas-U · Oct 26, 2017 at 06:26 AM
hi; the problem can be from any where u need to debug step by step what u think can make the problem from the scripts or the editor ; i cant see any thing from this script;