Using InvokeRepeating () causes objects to move up

public GameObject previousObject;
Renderer rend;
Renderer prevRend;

void Start()
{
    rend = GetComponent<Renderer>();
    prevRend = previousObject.GetComponent<Renderer>();

    InvokeRepeating("Position", 0, 0.000015f);
}

void Position ()
{
    this.transform.position = new Vector3 (previousObject.transform.position.x + prevRend.bounds.size.x / 2 + rend.bounds.size.x / 2, this.transform.position.y, this.transform.position.z);
}

However, if instead of using 0.000015f I use 0.0015, it doesn´t happen.

So that you are aware:

1 / 0.000015f =~ 66666.67
1 / 0.0015f =~ 666.67

Do you really intend to repeat that over 66,000 times per second? Even if you do 666 times per second, that still feels excessive for how simple it looks like your situation is. Why do you feel this is necessary?

@Feref2 My guess then is this is due to floating point precision. May I ask why you are working with such small values? and what you are trying to achieve through invoke repeating? :slight_smile: