Update iamagun.cs

pull/1/head
Marc Gauch 2023-12-08 22:10:22 +01:00
parent 89b1ba73ee
commit 9525ce625c
1 changed files with 4 additions and 1 deletions

View File

@ -11,7 +11,7 @@ public class iamagun : MonoBehaviour
public float kickDuration = 0.1f; // Duration of the kick animation public float kickDuration = 0.1f; // Duration of the kick animation
private AudioSource audio; private new AudioSource audio;
private Vector3 offsetPosition; private Vector3 offsetPosition;
private Quaternion offsetRotation; private Quaternion offsetRotation;
@ -25,6 +25,8 @@ public class iamagun : MonoBehaviour
// Flag to check if the kick animation is active // Flag to check if the kick animation is active
private bool isKicking = false; private bool isKicking = false;
private bool isInHand = false;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -38,6 +40,7 @@ public class iamagun : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (!isInHand) return;
if (OVRInput.IsControllerConnected(OVRInput.Controller.RTouch)) if (OVRInput.IsControllerConnected(OVRInput.Controller.RTouch))
{ {
// Get the local position and rotation of the controller // Get the local position and rotation of the controller