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.

Snap Drop Zone Locked Out State

See original GitHub issue

There’s an odd broken state the snap zones can get into where they can no longer snap new objects into them. The issue happens based on highlighting of the zone itself. Highlighting of a snapzone happens from OnTriggerEnter() and OnTriggerExit() calling ToggleHighlight(Collider collider, bool state). The problem lies in the fact that the ValidSnapObject() function checks to see if an object is grabbed. That makes sense for highlighting of an object, but not as much for turning it off. If the holding object is forced out of a grab and moved by an external force before it can be placed (destroyed, shot out of hand, blows up, manually removed, etc.), ToggleHighlight will not pass ValidSnapObject and thus, will not deactivate the highlight and will not allow any other objects to be snapped there because currentValidSnapObject is never cleared out.

I solved it locally like this, but it’s a hack at best:

        private void ToggleHighlight(Collider collider, bool state)
        {
            var ioCheck = ValidSnapObject(collider.gameObject, true);

            // E7_MAB we don't care about grabbing state on unhighlight
            if (state == false && ioCheck == null) {
                ioCheck = ValidSnapObject(collider.gameObject, false);
            }

            if (highlightObject && ioCheck)
            {

GitHub version of VRTK, maybe a month old, not sure Unity 5.4.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
mattboy64commented, Apr 14, 2017

Attached is a script to repro this issue in example 41.

  1. Attach the InvalidSnap.cs component to the red ball.

  2. Place the red ball in the far left snap zone.

  3. Script will force the ball back before a snap can happen.

  4. Observe that no other object can be placed in the spot.

The above code change allows the Unhighlight function in the snap zone to set it back into a usable state since it see the object leave the trigger.

image

InvalidSnap.zip

0reactions
thestonefoxcommented, Apr 14, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Snap Drop Zone Self Removal · Issue #1052
Currently the only way to remove an object from a snap drop zone is by grabbing it by hand. ... Snap Drop Zone...
Read more >
VRTK v3 - [Basics] Snap Drop Zones - YouTube
FOR VRTK V3 NOT VRTK V4 #VRTK Slack: http://chat.vrtk.io - http://invite.vrtk.io A tutorial on how to use the snap drop zones to place ......
Read more >
Snap Drop Zone
Provides a predefined zone where a valid interactable object can be dropped and upon dropping it snaps to the set snap drop zone...
Read more >
I have thousands of memories on my Snapchat account ...
My 6 year old Snapchat account was permanently locked for no reason. I did nothing that violated guidelines and received no warnings. Support...
Read more >
Reverse, lock, or disable keyframes in Motion
You can reverse keyframes to invert the corresponding animated effect without re-animating it, lock keyframes (individually or in groups) to prevent ...
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