I’m trying to have my sprite move in the direction that it is pointed (via rotation). I can do it with transform.position but I want the effect of AddForce. I’m getting an error saying that I can’t apply an * to a Vector3, an error saying I can’t convert an object to Vector2, and an error saying there are some invalid arguments. I’m pretty new to Unity and am still figuring this environment out.
Nevermind, I figured it out. I had the code set up for the command to be transform.position with the code:
Vector3 pos = transform.position;
Vector3 velocity = new Vector3(0, Input.GetAxis(“Vertical”) * speed * Time.deltaTime, 0);
pos += rot * velocity;
rb2d.AddForce(Vector3.forward * pos);
All I needed to do was change “Vector3 pos = transform.position;” to “Vector3 pos = Vector3.forward” and then change the last line to “rb2d.AddForce(pos);”