Top down shooter. Fire bullet.

This seems like it should be easy to do.

I have a top down perspective, and a cube representing the player. I want the cube to fire a bullet from its “front”, and have it so that even if the cube rotates, the bullet will fire in the direction the cube is facing. I can’t get the bullet to fire straight relative to where the cube is facing. How do i do this?

Assuming Y is up (in your case pointing towards the camera), for any script attached to the cube object you can get the “fire” direction by using:

Vector3 fireDir = transform.forward;

You’ll need to make sure this script is on the GameObject / Transform that rotates.