Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. void Update () {
  2.         var controller = OVRInput.GetActiveController() & (OVRInput.Controller.LTrackedRemote | OVRInput.Controller.RTrackedRemote);
  3.         #if UNITY_EDITOR
  4.             controller = OVRInput.GetActiveController() & OVRInput.Controller.RTouch;
  5.         #endif
  6.    
  7.         if (controller != OVRInput.Controller.None)
  8.         {
  9.             var rotation = OVRInput.GetLocalControllerRotation(controller);
  10.    
  11.             FlightStickSimulation.CalculateYawPitchRoll(rotation, out yaw, out pitch, out roll);
  12.         }
  13.         if(deltay > 10.0f){
  14.             deltay = 10.0f;
  15.         }
  16.         transform.Rotate(pitch*3.0f, 0, -roll*3.0f, Space.Self);
  17.         transform.Rotate(0, deltay, 0, Space.World);
  18.         deltay += roll*0.1f;
  19.         transform.position += transform.forward*Time.deltaTime*speed;
  20.         speed -= transform.forward.y*1.0f;
  21.         if (speed < 10.0f){
  22.             speed = 10.0f;
  23.         }
  24.         if (speed >30.0f){
  25.             speed = 30.0f;
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement