In the standard implementation of the linear drive (from Steam VR library), all update calls for LinearDrive.cs
are coming from the hand while the object is attached to it. In case of a distant linear movement, the object can not be attached to the hand directly, since attachment would instantly teleport it to the player's hand position. So, it would be impossible to use the LinearDrive.cs
However, we still can take the main idea from there, and rework it for our needs. I created a DistanceLinearDrive.cs
script, where added public OnAttachement()
, and DistanceHandUpdate()
functions. The first function calculates the initial linear mapping offset. Two others calculate the linear mapping value based on the change in the hand's position and apply it to the object's position in the form of lerp.