Offsetting transform.position by local rotation

I’m using a script to move my player object between exterior/interior setpieces. I want to move the player from Trigger A to Trigger B, but offset Player position a few units on Trigger B’s Z axis so the player doesn’t arrive in the trigger. I’m not sure how to transform the local rotation of Trigger B into an offset in global space, though.

    private GameObject Player;
    public GameObject Destination;

    // Use this for initialization
    void Start ()
    {
        if (Player == null)
            Player = GameObject.FindWithTag("Player");
    }
   
    void OnTriggerEnter(Collider other)
    {
        Player.transform.position = Destination.transform.position;
    }
... = Destination.transform.position + (Destination.transform.forward * someScalarValue);

(always getting my axes mixed up; replace “forward” with “up” or “right” or negatives of them to get whichever direction you need)

1 Like

perfect, thanks so much! :smile: