-
Notifications
You must be signed in to change notification settings - Fork 0
Evidence Collection
Users can walk around the scene and collect evidence in provided bags.

Each bag tracks what is put inside it - if the item is on the warrant, it adds to the user's current score. If not, then the user's score is penalized.
In VR, objects set to the same layer can be attached to socket objects. Each bag has a separate socket that only accepts one object before disabling.
When grabbing a bag, the object clones itself and replaces the space with a new one. These share the same properties as the original object at startup.
Evidence must be placed inside a bag and on the cart to be scored.

-
The cart movement is calculated by getting the initial angle of rotation when a player grabs the cart, then while grabbing the cart, the change in rotation is added to the rotation of the cart. Also, the colliders for all objects inside the cart are turned off to improve performance.
void OnGrab(SelectEnterEventArgs args) { // Optional: Save initial grab rotation if needed for more complex rotation handling interactor = args.interactorObject; initialHandYRotation = interactor.transform.rotation.eulerAngles.y; initalCartYRotation = transform.eulerAngles.y; CartTriggerZoneDectector cartTrigger = GetComponentInChildren<CartTriggerZoneDectector>(); if (cartTrigger.objectsInCart.Count != 0) { foreach (GameObject key in cartTrigger.objectsInCart.Keys) { Collider[] objectColliders = key.GetComponentsInChildren<Collider>(); foreach (Collider col in objectColliders) { col.enabled = false; // Disable each collider } } } } void FixedUpdate() { if (grabInteractable.isSelected) { float newHandYRotation = interactor.transform.rotation.eulerAngles.y; float YRotation = (initalCartYRotation - (initialHandYRotation - newHandYRotation)); Quaternion newRotation = Quaternion.Euler(0, YRotation, 0); transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, Time.fixedDeltaTime * rotationDampening); } }