protected void FixedUpdate() { if (!_initialized) { return; } var isLoading = SuperController.singleton.isLoading; if (!_isLoading && isLoading) { OnSceneChanging(); } else if (_isLoading && !isLoading) { OnSceneChanged(); } _isLoading = isLoading; if (_physicsIteration == 0) { DebugDraw.Clear(); } UpdateDevice(); if (_physicsIteration == 0) { DebugDraw.Enabled = false; } _physicsIteration++; }
protected void OnDestroy() { DebugDraw.Clear(); _valuesSource?.Dispose(); _motionTarget?.Dispose(); _valuesSource = null; _motionTarget = null; }
protected void OnDestroy() { try { DebugDraw.Clear(); _device?.Dispose(); _outputTarget?.Dispose(); } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } }
protected void FixedUpdate() { if (!_initialized || SuperController.singleton.isLoading) { return; } if (_physicsIteration == 0) { DebugDraw.Clear(); } try { _valuesSource?.Update(); if (!SuperController.singleton.freezeAnimation && _valuesSource != null && _motionTarget != null) { var upValue = UpRangeSlider.val * (_valuesSource.GetValue(DeviceAxis.L0) - DeviceAxis.DefaultValue(DeviceAxis.L0)) * 2; var rightValue = RightRangeSlider.val * (_valuesSource.GetValue(DeviceAxis.L1) - DeviceAxis.DefaultValue(DeviceAxis.L1)) * 2; var forwardValue = ForwardRangeSlider.val * (_valuesSource.GetValue(DeviceAxis.L2) - DeviceAxis.DefaultValue(DeviceAxis.L2)) * 2; var yawValue = YawRangeSlider.val * (_valuesSource.GetValue(DeviceAxis.R0) - DeviceAxis.DefaultValue(DeviceAxis.R0)) * 2; var rollValue = RollRangeSlider.val * (_valuesSource.GetValue(DeviceAxis.R1) - DeviceAxis.DefaultValue(DeviceAxis.R1)) * 2; var pitchValue = PitchRangeSlider.val * (_valuesSource.GetValue(DeviceAxis.R2) - DeviceAxis.DefaultValue(DeviceAxis.R2)) * 2; var newUp = Vector3.zero; if (UpDirectionChooser.val == "+Up") { newUp = Vector3.up; } else if (UpDirectionChooser.val == "+Right") { newUp = Vector3.right; } else if (UpDirectionChooser.val == "+Forward") { newUp = Vector3.forward; } else if (UpDirectionChooser.val == "-Up") { newUp = -Vector3.up; } else if (UpDirectionChooser.val == "-Right") { newUp = -Vector3.right; } else if (UpDirectionChooser.val == "-Forward") { newUp = -Vector3.forward; } var coordinatesRotation = Quaternion.FromToRotation(Vector3.up, newUp); var rotation = Quaternion.Euler(coordinatesRotation * new Vector3(pitchValue, yawValue, rollValue)); var offset = coordinatesRotation * new Vector3(rightValue, upValue, forwardValue); _motionTarget?.Apply(offset, rotation); } } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } if (_physicsIteration == 0) { DebugDraw.Enabled = false; } _physicsIteration++; }