public void Awake() { FFBManager.Initialize(); // Initialize if it's not already FFBManager.EnableConstantForce(); // Enable Constant Force effect FFBManager.EnableSpringForce(); // Enable Spring Effect RawDeviceInfo = FFBManager.devices; FFBManager.OnDeviceStateChange += OnDeviceStateChange; // Register listner }
/// <summary> /// Register the base callback if not yet registered. /// </summary> public void RegisterBaseCallback(vJoy joystick, uint id, FFBManager ffb) { this.FFBManager = ffb; this.Joystick = joystick; this.Id = id; // Read PID block this.Joystick.FfbReadPID(this.Id, ref this.PIDBlock); if (!isRegistered) { this.wrapper = this.FfbReceiverFunction; //needed to keep a reference! Joystick.FfbRegisterGenCB(this.wrapper, IntPtr.Zero); this.isRegistered = true; } }
/// <summary> /// Register a FFB callback for current vJoy device ID /// </summary> /// <param name="ffb"></param> /// <returns></returns> public int StartAndRegisterFFB(FFBManager ffb) { // Start FFB #if FFB if (Joystick.IsDeviceFfb(vJoyDevID)) { // Register Generic callback function // At this point you instruct the Receptor which callback function to call with every FFB packet it receives // It is the role of the designer to register the right FFB callback function // Note from me: // Warning: the callback is called in the context of a thread started by vJoyInterface.dll // when opening the joystick. This thread blocks upon a new system event from the driver. // It is perfectly ok to do some work in it, but do not overload it to avoid // loosing/desynchronizing FFB packets from the third party application. FFBReceiver.RegisterBaseCallback(Joystick, vJoyDevID, ffb); } #endif // FFB return(0); }
public void SetConstantForceMagnitude0() { FFBManager.ConstantForce(0); }
public void SetConstantForceGain0() { FFBManager.SetConstantForceGain(0.0f); }
public void SetConstantForceGain() { FFBManager.SetConstantForceGain(ConstantForceGain); }
public void FixedUpdate() { FFBManager.ConstantForce(ConstantForceMagnitude * ConstantForceMagnitudeMultiplier); }