using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 胶带控制案例 /// public class JD_Controller_Example : MonoBehaviour { public ChivaVR_JD_ShaderController[] controllers; // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Z)) { SetJDType(JDLineType.lineoff); } if (Input.GetKeyDown(KeyCode.X)) { SetJDType(JDLineType.lineon_JDJuan); } if (Input.GetKeyDown(KeyCode.C)) { SetJDType(JDLineType.lineon_NoJDJuan); } SetJDAngle(Input.GetAxis("Horizontal")); SetJDDirectionAngle(Input.GetAxis("Vertical")); } /// /// 设置胶带类型 /// /// public void SetJDType(JDLineType type) { foreach (var item in controllers) { item.SetJDLineType(type); } } /// /// 设置胶带缠绕角度 /// /// public void SetJDAngle(float delta) { foreach (var item in controllers) { //可直接设置目标角度 item.SetJDValue((item.value + delta)); } } /// /// 伸出部分旋转角度 /// /// public void SetJDDirectionAngle(float delta) { foreach (var item in controllers) { item.SetJDDirectionAngle((item.backAngle + delta)); } } }