I have a Block and I want it to go somewhere when walked into. The block is not going to the quardinets though

I have It going to X 176 Y 16 Z 127 But its going to X 5.681625 Y-328.1724 Z374.8713
There is absoluetley nothing there and its so confusing here is the code :`using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NPCDestination : MonoBehaviour
{

void OnTriggerEnter(Collider other)
{
    if (other.tag == "NPC")
    {
        this.gameObject.transform.position = new Vector3(176, 16, 127);
    }
}

}
`

do have a parent object to that npcdestination object? because the inspector will always show you the local coordinates if there is a parent object.

–

Should I place the NPCDest into the NPC, Sorry I am a beginner.

–

2 Answers

2

Should I place the NPCDest into the NPC, Sorry I am a beginner.

@GECKOBOY123:

I’m not experienced, but I can think of 2 things:

  • Maybe try using this.transform.position without gameObject?
  • maybe the position is relative to another object instead of world space?

I hope this helped!