question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Feature: VRTK_ObjectLerp (lerp an VRTK_InteractableObject on grab).

See original GitHub issue

Overview

General idea is to add new functionality that smoothly animates an object into position when you grab it. This will be an optional / extra script that you can attach to an VRTK_InteractableObject, providing a slightly different mechanic and visual from the existing immediate grab.

Code In-progress

  • Created a new script class called VRTK_ObjectLerp that smoothly handles the lerp position and rotation of an object over time.
  • You can attach this script to an VRTK_InteractableObject, which then will set itself up to use the VRTK_ObjectLerp.
  • When an object is grabbed by VRTK_InteractGrab this class checks on the grabbing VRTK_InteractableObject to see if there is a valid / configured VRTK_ObjectLerp available, and if the object is set to lerpTransformOnGrab.
  • If the VRTK_InteractableObject is setup to lerp on grab, then rather than complete the grab as normal, the VRTK_InteractGrab method calls back to a new method on the VRTK_InteractableObject that will start the lerp to position, i.e. StartLerpTransformOnGrab.
  • The VRTK_InteractableObject will then call the VRTK_ObjectLerp to start a coroutine for the lerp to position, i.e. DoObjectTranslation.

Not yet done, to be confirmed:

  • Once the DoObjectTranslation method completes, callback / notify the VRTK_InteractableObject that it’s done.
  • The VRTK_InteractableObject then calls the VRTK_InteractGrab script to grab the object again. Only this time it will tell the VRTK_InteractGrab somehow that we don’t need to lerp, just do a normal / immediate grab.

Other things to consider, as per our chat on Slack:

  • What to do if the object is ungrabbed mid-way, before completion: : Move the object back to the start position. : Or if it’s pass the half way point complete the lerp. : Or just drop the object where it is. : Perhaps a combination, could have settings to specificy what you want to happen.
  • From @bddckr: “Should work with every grab mechanic, but I think currently some of these things take at least 1 frame, so would be visible. Maybe instantiate a temporary copy and turn of visibility and collisions etc.”: : Not sure I understand what this is referencing yet… perhaps I’ll see this issue once the base code I’ve explained above is working.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
wildstyle007commented, Aug 18, 2017

Got this working last night, should have a PR in this weekend.

1reaction
thestonefoxcommented, Sep 13, 2017

Sorry for the delay, just time always is against me looking at things 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

VRTK_InteractableObject
VRTK_BaseGrabAction - A Grab Action mechanic for determining how to manipulate the Interactable Object when grabbed by the secondary interacting object. Script ...
Read more >
[002] Interacting with objects - VRTK v4 Weekly Livestream
9:35 - Brief reason for why Tilia uses Unity Package Manager and not Unity Asset Store 10:02 - Make an object interactable with...
Read more >
Object manipulator - MRTK 2
Rotate about grab point: Rotate object using rotation of the hand, but about the pointer ray hit point. Useful for inspection. Two handed ......
Read more >
HTC Vive Tutorial for Unity
Learn how to use the HTC Vive with Unity! Grab and throw objects, shoot lasers and teleport around an area.
Read more >
VIVE Archives
It's worth noting that another great way to setup UI interactions is via VRTK (VR Tool Kit). VRTK is something I've used in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found