< Summary

Class:SnapToTrigger
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/escapeVr/Assets/Script/room2/SnapToTrigger.cs
Covered lines:19
Uncovered lines:0
Coverable lines:19
Total lines:38
Line coverage:100% (19 of 19)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Start()0%000100%
Update()0%000100%
Snap(...)0%000100%

File(s)

D:/--UnityProject/VR/VRExplorer_subjects/escapeVr/Assets/Script/room2/SnapToTrigger.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4using UnityEngine.XR.Interaction.Toolkit;
 5using UnityEngine.XR.Interaction.Toolkit.Transformers;
 6
 7public class SnapToTrigger : MonoBehaviour
 8{
 9    private XRGrabInteractable interactable;
 10    private XRGeneralGrabTransformer transformer;
 11    private Rigidbody rb;
 12    private bool isSnapped;
 13
 14    private void Start()
 715    {
 716        interactable = GetComponent<XRGrabInteractable>();
 717        transformer = GetComponent<XRGeneralGrabTransformer>();
 718        rb = GetComponent<Rigidbody>();
 719    }
 20
 21    private void Update()
 1054222    {
 1054223        if (isSnapped)
 150624        {
 150625            gameObject.transform.RotateAroundLocal(new Vector3(0, 1, 0), 0.05f);
 150626        }
 1054227    }
 28
 29    public void Snap(Vector3 trigger_pos)
 130    {
 131        interactable.enabled = false;
 132        transformer.enabled = false;
 133        gameObject.transform.position = new Vector3(trigger_pos.x, trigger_pos.y + 0.4f, trigger_pos.z);
 134        gameObject.transform.rotation = new Quaternion(0, 0, 0, 0);
 135        rb.constraints = RigidbodyConstraints.FreezeAll;
 136        isSnapped = true;
 137    }
 38}