// Update is called once per frame void LateUpdate() { // The Cave will automaticall distribute the script and run it from all PCs, // to avoid this behaviour we need to check if the executing PC is the Master // Otherwise the Cave will freeze if (!controller.debugging && (GetComponent <NetworkIdentity>().isServer || controller.vive)) { // take steeringAngle from sensor angle = (float)Test_ReadData.AngleForMono; //smoothing the angle in 3 steps // 1. smoothing the angle amplitude over all because real input degrees are to rough... (I get motion sickness) //angle = angle / 1.7f; // 2. Smooth the angle over time with an average of the array of the rawSensorinput if (inputHandling.smoothRawSteerAngle) { angle = inputHandling.SmoothRawAngle(angle); } // 3. Decrease the amplitude at the center of Steering (to decrease Jiggle) if (inputHandling.smoothSteerAngleAtCenter) { angle = inputHandling.SmoothSteerAngleAtCenter(angle); } // somehow the sensor Input gets decreased by aprox. 50000 if connected to the cave speed = (float)Test_ReadData.speedForMono; // * 50000; // One step to smooth the speed (same as SmoothRawAngle) if (inputHandling.smoothRawSpeed) { speed = inputHandling.SmoothRawSpeed(speed); } // Apply the data to the ingame Cycle ApplySensorDataToBycicle(); // velocity.text = speed.ToString() + " km/h"; //Lerp the Debug Camera smoothly along with the cyclist, attaching the gameObject like this reduces jitter drastically cameraHolder.transform.position = Vector3.Lerp(cameraHolder.gameObject.transform.position, camLerpPoint.transform.position, .5f); cameraHolder.transform.rotation = Quaternion.Lerp(cameraHolder.gameObject.transform.rotation, camLerpPoint.transform.rotation, .5f); // if the cylce is shown, various gameObjects are set active, or inactive ShowVirtualBicycle(); } // if in Debug Mode, take the Data from inEditorValues //else if (controller.debugging) //{ // angle = angleDebug; // speed = speedDebug; //} //if (Time.time - timer <= 1.0f) //{ // framecounter++; //} //else if (Time.time - timer > 1.0f) //{ // Debug.Log("Frames/s" + framecounter); // framecounter = 0; // timer = Time.time; //} }