I have an object that with the following code:
[SerializeField] private float speed = 10f;
public bool go;
void Update()
{
if (rb.velocity.magnitude < .2f && go)
{
rb.AddRelativeForce(speed * Time.deltaTime * transform.forward);
}
if (!go)
{
rb.velocity = Vector3.zero;
}
}
With no other input, transform.forward move the object positively in the z-axis, but if I rotate the object in the inspector to Y:90, the movement does a 180 and starts going negatively in the z-axis. If I do Y:45 it moves positive X. Same thing with X-axis rotation, X:90 goes backwards, X:45 goes negative Y.
Am I missing something? Why does transform.forward change by 2x the rotation I give the object?