Consistent Position Checks

Hi, all!

I have an object being launched with physics, and every time it travels one unit on the X/Y axis, I am having it plot an ordered pair.

My only problem here is that it really varies a lot with when it plots. It is traveling relatively quickly but I think there is definitely a way to get the plotted points more exact and consistent. The spacing is very erratic right now.

Any tips?- Thanks!- YA

If I am understanding your question right instead of just plotting one every update you may need to plot multiple positions each update. It would have to be something like this.

public class PointPlotter: MonoBehaviour
{
     //this is not technically needed by instead of creating a variable every update
     //to be able to do easy manipulation of the previous plotted point we just
     //create one here
     Vector3 lastPlotPoint;
     List<Vector3> points = new List<Vector3>();

     //these two variables can be set within the inspector in unity
     public Transform trackedObj;
     public float PlotIncrement;

     void Start()
     {
          //set the initial position
          lastPlotPoint = trackedObj.position;
     }
     void Update()
     {
         //find the direction the object is moving
         Vector3 direction = trackedObj.position - lastPlotPoint;
          
         
         //loop moving by the increment till the current position is reached
         while(Vector3.Distance(lastPlotPoint,trackedObj.position) > PlotIncrement)
         {
              //add a single increment to the last plot point in the direction the object is moving
              lastPlotPoint += direction.normalized * PlotIncrement;
              //add the point to the plotted list
              points.Add(lastPlotPoint);     
         }
         
     }
}

This should work for plotting a point at every increment length that can be adjusted no matter the speed the object is moving. Hope this helps.