I’m trying to move an object along the x-axis, I’m using a transform.position for this, but my problem is when I run it, unit throws me this message and my object moves very fast overshooting.
“due to floating-point precision limitations, it is recommended to bring the world coordinates of the Gameobject within a smaller range.”
This is the code that i used:
public float speed;
void Update () {
transform.position += new Vector3 (speed * Time.deltaTime, transform.position.y, transform.position.z );
}
You are using “+=” so that means you are adding the existing y and z values to the y and z position every frame.
If its sitting at z=10, then its going to move 10meters in z next frame.
The value gets larger each frame.
Use a y and z value of 0f to lock the movement of those directions.