static DirectInputStartupEditor() { UnityEditor.EditorApplication.quitting += OnQuitting; Debug.Log(FFB.GetActiveWindow()); FFB.ForceFeedBackInit(); // is the window already running? Debug.Log("ForceFeedBack UP and Running"); }
private void ReleaseDirectInput(PlayModeStateChange state) { if (state == PlayModeStateChange.ExitingPlayMode) { FFB.FreeDirectInput(); //Currently buggy, crashs edtior } }
private void StopDirectInput(PlayModeStateChange state) { if (state == PlayModeStateChange.ExitingPlayMode) { FFB.StopForceFeedback(); //Currently buggy, crashs edtior } }
//Carcontroller.GetSteering (-1, 0 ,1 ) * 540 //Target //Input *540 //Input Angle // IF -1 Right Direction // IF 1 Left Direction /*IEnumerator GoToPosition() * { * while (1) * { * _carController.GetSterring() * } * }*/ #if !UNITY_EDITOR private void OnDestroy() { if (!FFB.needInit) { FFB.FreeDirectInput(); } else { FFB.needInit = false; return; } }
private void OnTriggerExit(Collider other) { if (mFFB == null) { return; } print("止める"); mFFB.Vibration(0, 0f); mFFB = null; if (mSource.clip != null) { mSource.Stop(); } }
private void OnTriggerEnter(Collider other) { mFFB = other.GetComponent <FFB>(); if (mFFB == null) { return; } print("動かす"); mFFB.Vibration(mPower, mTime); if (mSource.clip != null) { mSource.Play(); } }
void Start() { _carController = GetComponent <CarController>(); _manualController = GetComponent <ManualController>(); _controlSwitch = GetComponent <ControlSwitch>(); if (shouldInit && FFB.needInit) { FFB.ForceFeedBackInit(); #if !UNITY_EDITOR FFB.AcquireDevice(); #endif } #if UNITY_EDITOR FFB.AcquireDevice(); #endif }
private static void OnQuitting() { Debug.Log("Releasing Direct Input!"); FFB.Release(); }
public void SetManualForceFeedbackEffect(float force) { int rounded = (int)force; FFB.SetDeviceForceFeedback(rounded, 0); }
public void SetAutoPilotForceFeedbackEffect(float force) { int rounded = (int)-force; FFB.SetDeviceForceFeedback(rounded, 0); }