Hello all,
I’m playing with a program using the HTC Vive. Have a laser pointer and a raycast coming from the controller. What I’m trying to do is when I point at an object and hold the trigger, I want the object to lock to the raycast hitpoint so I can dragit to another position and then drop it when the trigger is realeased.
I really don’t want to parent it to the controller, because I have thousands of game objects and don’t want to have to keep track of what to parent them back to later when I want to put the game object back in it’s original position.
When the trigger is pressed, “LockPosition” is set to true and then set to false when the trigger is realeased. I have this in Void Update(), It moves the gameobject, but it moves away from the hitpoint rather than locking to it. Any ideas?
MoveTransform = hitInfo.transform;
if(LockPosition)
{
CurrentSelectedObject.transform.position = Vector3.Lerp(CurrentSelectedObject.transform.position, MoveTransform.position, Time.deltaTime);
}