rabidus-test/Assets/BNG Framework/Scripts/Extras/HandModelSwitcher.cs

32 lines
778 B
C#
Raw Normal View History

2023-07-24 16:38:13 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BNG {
public class HandModelSwitcher : MonoBehaviour {
public int HandModelId = 1;
public HandModelSelector hms;
void Start() {
if(hms == null) {
hms = FindObjectOfType<HandModelSelector>();
}
if(hms == null) {
Debug.Log("No Hand Model Selector Found in Scene. Will not be able to switch hand models");
}
}
public void OnTriggerEnter(Collider other) {
if(other.gameObject.GetComponent<Grabber>() != null) {
// Switch to this hand model
hms.ChangeHandsModel(HandModelId, false);
}
}
}
}