ViveBikeController.cs 676 B

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