I'm programming a script where force would be applied in the transform.forward direction once a ray hit another game object. The problem is that transform.forward keeps going backwards, even though the arrow goes the opposite way.

In addition, I'm having the objects rotate to face the player, but it only moves on the world's Z axis instead of the direction it's facing.

Any solutions?

    if (Physics.Raycast (transform.position, fwd, hit, 100) && hit.transform.gameObject.tag == "Player"){
        print ("Hit the player");
        Debug.DrawLine (transform.position, hit.point);
        Chase();
        }

function Chase(){
var rotate = Quaternion.LookRotation(player.position - transform.position, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * Damp);
rigidbody.AddRelativeForce(transform.forward * 12);
}

To make it go forwards at a -.

rigidbody.AddRelativeForce(transform.forward * -12);

I think that's it... Hope this helps.

You might try either this:

rigidbody.AddRelativeForce(Vector3.forward * 12);

Or this:

rigidbody.AddForce(transform.forward * 12);

As it is now, you're treating a world-space vector as a local vector, which may be why the results seem to be incorrect.