The aiVector is a Vector2 that I set the axis. Since this is called in fixed update I use a small value for the direction I want it to move.
The AIMovementSpeed is a float.
This works great but I want to limit the X or Y that the object can move. I do not want to use a trigger or collider, I have those and they serve another purpose. Although I have seriously been rethinking it.
Is there a way to move an object with the velocity but clamp its X or Y value between a min and max?
The message here being that adding a Rigidbody(2D) to a GameObject means you’re giving it control of the Transform so you shouldn’t touch it. You should use it as a proxy and always go via its API.
I’m sorry I forgot to come back and update. Changing my player to move with this had no noticeable change. Changing the AI did have a noticeable change. The AI moves much more smoothly and natural.