Dropping an object behind player in respect to rotation,How to drop an object behind the player

Hello everyone


I’m making a 2D multiplayer racing game. And I want upon a keystroke to instantiate a object behind my current position.


I tried to use my current position while updating the y value to y - 1. It dosen’t work on turns and many other scenarios due to rotation.


How can I instantiate an object behind my current position in respect to rotation? Thanks in advance!

@Mseg14

If you want to instantiate at the back with respect to object rotation, you should use transform.up or transform.right instead of subtracting values individually from y or x component.

    Vector3 newPos = transform.position -  transform.up;
    Instantiate(objToInstantiate, newPos, Quaternion.identity);