SHARE
TWEET

Untitled

a guest Apr 2nd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top