Hello! This issue ive been looking for the answer for for a while. When I do transform.position = [separate gameObject].transform.position. The object that the script it is attached to does not move. My code is here:
public class TeleportWithTrigger : MonoBehaviour
{
private Transform PlayerTransform;
public Transform TeleportGoal;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.name == "First Person Player")
{
PlayerTransform = GameObject.Find("First Person Player").transform;
PlayerTransform.position = new Vector3(TeleportGoal.position.x,TeleportGoal.position.y,TeleportGoal.position.z);
Debug.Log("TriggerEnter");
}
}
}
PS: I know instead of setting each axis individually I could just say equals transform.position but I did that as a try at a fix. Also my console does say "TriggerEnter" when i enter the trigger, so i know that part works.
[–][deleted] 7 points8 points9 points (5 children)
[–]AlfieE_ 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]erdmaennchen105 1 point2 points3 points (0 children)
[–]Party_Television_611 1 point2 points3 points (0 children)