ViveBikeController.cs 607 B

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