I am dragging an object in VR (Axon 7, Daydream), and to have it a bit lagged behind, I change the velocity every frame to the direction where the target is.
Problem: On the phone, you see that approximately every 10th time, the object does not move, even though it does have a velocity. On the GIF, you see two of those skips, the number below shows the alleged velocity. I think it doesn’t happen on the PC, but I can’t really tell, because you only notice that in VR with 60fps.
I will try to answer my own problem: I think that Unity allows physics updates in the Update() function, but executes only those that would go along with the FixedUpdate() function. So I save the objects last position and last last position, and compare the actual with the last position. If they are the same while velocity is > 0, it didn’t execute the physics update, and I move the object myself for the distance of (actual position - last last position). That smoothes out the mistakes and makes it look quite nice.
Okay thanks, I am learning to understand garbage collection, but does it only pause the object’s physics? Because I can manually change the position, just not by using .velocity
After a few weeks with Unity, I understand the problem and have a solution: The physics do in fact skip frames (when at 60fps), but that can be avoided with Rigidbody > Interpolation to Interpolate. As this is quite expensive, I only apply that to the object that I am currently holding, and that results in a nice and smooth motion.