2D Top-Down Movement: Transform.up and right don't change

I’ve been working on a top-down 2D RPG and trying to figure out how to fire a projectile or swing a sword in the same direction that the player is facing. I’m using a RigidBody2D attached to the player to move it around the world using addForce.

I’m trying to determine the direction my player is facing using transform variables (e.g. transform.right) but they always show the same values.

playerScript.cs: https://github.com/bdickason/stormsword/blob/weapons/Assets/scripts/characters/PlayerScript.cs

    private MoveScript moveScript;

    // Speed of the player
    public Vector2 speed = new Vector2(50, 50);

    // Retrieve axis information from controller
    float inputX = Input.GetAxis("Horizontal");
    float inputY = Input.GetAxis("Vertical");

    // Calculate movement per-direction
    moveScript.direction = new Vector2(inputX, inputY);

moveScript.cs: https://github.com/bdickason/stormsword/blob/weapons/Assets/scripts/characters/MoveScript.cs

    // Speed of object
    public float speed = 400;

    // Direction of object
    public Vector2 direction = new Vector2(-1, 0);

    // Actual movement
    private Vector2 movement = new Vector2(0, 0);

    // Update is called once per frame
    void Update () {

        /* Check if character is moving */
        movement = direction * speed;	 // Calculate movement amount
  	}

  	void FixedUpdate() {
  	      	// Apply the movement to the rigidbody
  	      	rigidbody2D.AddForce (movement);
  	}

This allows me to move my character around the screen easily.

Based on dozens of other Answers on this site, as the player moves around, I should be able to access the player’s transform.right or transform.up to determine which direction the player is facing.

Unfortunately, I always get the same results when debugging or using Debug.Log for both of the above variables (as well as transform.forward).

transform.up: (0, 1.0, 0)
transform.right: (1.0, 0, 0)
transform.forward: (0, 0, 1.0)

In my code, I’m trying to access this information from my weaponScript.cs, but I’ve tried debugging the values on the playerScript itself (which should access the player’s transform) as well as the rigidBody2d object’s transform and I still get the same, unchanging results depicted above.

The project is available for download here: https://github.com/bdickason/stormsword/tree/weapons

Any help in determining where my character is facing and why my rigidbody does not change direction would be appreciated!

(Note: I’ve also tried a velocity-based approach by using rigidbody2D.velocity with the same results)

I have the same problem :(.
If i will find the solution i will share with you mate.

You don’t appear to do any rotating of the Player, you just have a direction of movement. So, if by facing you simply mean the direction of movement, all you need is the velocity vector:

Vector2 MyFacing = rigidbody2D.velocity.normalized;

You can take that vector, multiply it by a speed float value, and assign it to the velocity of a projectile.

.up, .right, .forward, and so on, are static constants. They don’t have anything whatsoever to do with the vector they’re called on (in fact you really shouldn’t call them on a specific vector at all); you can’t use them to get information out.