Добавлена вибрация при столкновении
This commit is contained in:
parent
0918897164
commit
c5b2237f52
@ -2519,6 +2519,10 @@ MonoBehaviour:
|
||||
_Menu: {fileID: 2491700103206237577, guid: 4a7a5deffd236a749be84a26f6641caf, type: 3}
|
||||
_ForwardSource: {fileID: 4098506887931384771}
|
||||
move: {fileID: 5964534008193362612}
|
||||
_Intensity: 1
|
||||
_Duration: 2
|
||||
_LeftController: {fileID: 5690972490677766018}
|
||||
_RightController: {fileID: 8496130537008775401}
|
||||
--- !u!114 &6816638489069482198
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
|
||||
public class HitDetectorScript : MonoBehaviour
|
||||
@ -12,6 +9,13 @@ public class HitDetectorScript : MonoBehaviour
|
||||
[SerializeField] private GameObject _ForwardSource;
|
||||
[SerializeField] private ActionBasedContinuousMoveProvider move;
|
||||
|
||||
[Range(0f, 1f)]
|
||||
[SerializeField] private float _Intensity;
|
||||
[SerializeField] private float _Duration;
|
||||
|
||||
[SerializeField] XRBaseController _LeftController;
|
||||
[SerializeField] XRBaseController _RightController;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
//Debug.Log(other.gameObject.name);
|
||||
@ -36,11 +40,21 @@ public class HitDetectorScript : MonoBehaviour
|
||||
// Создание объекта
|
||||
Instantiate(_Menu, newPos, newRot);
|
||||
|
||||
TriggerHaptic(_LeftController);
|
||||
TriggerHaptic (_RightController);
|
||||
|
||||
Debug.Log("Player was hitted car");
|
||||
//SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerHaptic(XRBaseController controller)
|
||||
{
|
||||
if (_Intensity > 0)
|
||||
{
|
||||
controller.SendHapticImpulse(_Intensity, _Duration);
|
||||
}
|
||||
}
|
||||
//private void OnCollisionEnter(Collision collision)
|
||||
//{
|
||||
// Debug.Log(collision.gameObject.name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user