ViveBikeController.cs 719 B

12345678910111213141516171819202122232425262728
  1. using Controller.Bicycle;
  2. using UnityEngine;
  3. using Valve.VR;
  4. namespace Controller
  5. {
  6. [RequireComponent(typeof(IBicycleController))]
  7. public class ViveBikeController : MonoBehaviour
  8. {
  9. public SteamVR_Action_Pose steerPose;
  10. public float multiplier = 40f;
  11. private IBicycleController bicycleController;
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15. bicycleController = GetComponent<IBicycleController>();
  16. }
  17. // Update is called once per frame
  18. void Update()
  19. {
  20. var rot = steerPose.localRotation.y;
  21. bicycleController.CurrentSteerAngle = rot * multiplier;
  22. }
  23. }
  24. }