Smoothing Random OSC data

Hi, I’m attempting to smooth some OSC data to make my object movements less horrible.

What i want to achieve is a smooth transition between the incoming data thats manipulating my X,Y,Z position.

I think i need to store my X values into a list and then do the smoothing, any help would be brilliant.

Thanks

void OnReceiveXYZ(OscMessage message){
        float x = message.GetFloat(0);
        float y = message.GetFloat(1);
        float z = message.GetFloat(2);

        transform.position = new Vector3(x,y,z);
    }

    void OnReceiveX(OscMessage message) {
        float x = message.GetFloat(0);

        Vector3 position = transform.position;

        position.x = x / 100 ;

        transform.position = position;
    }

I know nothing about this, but it looks like it’s updating the position in real time when it recieves a message, so there might be stalls and so forth. I would think you would have to do a prediction based on the last 2 positions and the time between. If there was a change in speed or direction, it would actually look worse, but if the speed and direction were constant, it would look better.

Otherwise do a lerp everytime you get a new position in update from the last position, but it would cause a slight lag from real time.