void Update () {
if (Input.GetButton(“Horizontal”) && Input.GetAxis(“Horizontal”) > 0) {
transform.Rotate(0,0,1);
transform.TransformPoint(new Vector3(-speed,0,0) * 2);
}
}
Here’s my current piece of code.
transform.Translate() doesn’t correctly move the assets that I wish to move.
As you can imagine, the object rotates, and as it translates relative to itself, it moves in an arc with the rotation. The solution to this in my head would be translating the global position of the object while rotating, which would eliminate the discrepancy.
TransformPoint seemed to be what I was looking for according to the Unity documentation, but the object I am trying to move remains in place.