ExtendRealityLtd / Tilia.Interactions.SnapZone.Unity

A spatial zone in which an interactable object can be snapped into the designated area for the Unity software
MIT License
5 stars 1 forks source link

Snapzone jittering when moving. #225

Open kyawai opened 1 year ago

kyawai commented 1 year ago

Environment

Tested on Unity 2021.3.16f1

Steps to reproduce

  1. Create a new Unity project in Universal RP.
  2. Add the VRTK package manager, relevant packages and OpenXR Plugin.
  3. Following the "[06] Building a VR Climbing Obstacle Course Part 1 - VRTK v4 Weekly Livestream" to set up the Tracked Alias, UnityXR Plugin Framework, adding Input Action Mapping and hand interactors, and implementing Axis Move Slide Horizontal movement
  4. Created 2 cubes, turned into Interactables. One of the cubes inside it's Mesh Container, added a Snap Zone. The snap zone has not been changed except from reducing the Activation Collision area and moving Snap Destination.

Expected behaviour

In play mode in VR, I'm expecting for the 2 cubes to be separate, when I pick them up and snap them together, they stay together, I am then able to walk around with them, drop them and pick them up (by grabbing the cube with the snap zone object), they will still be snapped and smoothly moving around with my movement.

Current behaviour

In play mode in VR, currently if the cubes are picked up and snapped the snap zone works as expected. However, when dropped whilst still snapped and picked up again, walking around with them causes jittering to the object that has been snapped. It also jitters when the cube starts off as snapped.

Extra notes:

This is an issue that happens sometimes, when I first encountered this issue, I recreated the snap zone and it worked as expected for the first day of working on it, the next day it has gone back to jittering.

thestonefox commented 1 year ago

@kyawai do you have a video of the issue occurring?

thestonefox commented 1 year ago

One thing that could be causing this issue is because you've nested a SnapZone within an Interactable, the snap zone collider will be potentially constantly colliding with the interactable collider and when you try snap something it, it could tank your performance and cause jittering.

You could try using a Collision Ignorer (or the layers collision matrix in Unity) to get the Interactable colliders to ignore collisions with the nested SnapZone collider.

Then you won't see any performance reduction.