Search Unity

Force Feedback Controller Toolkit

Discussion in 'Assets and Asset Store' started by Zaddo67, Nov 20, 2012.

  1. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Force Feedback Toolkit v1.2 Released



    The Force Feedback Toolkit makes it easy for you to integrate force feedback devices into your game. ​



    Update March 2014:

    I decided not to publish this asset in the Asset Store due to the release of the Logitech Force Feedback Asset

    I have subsequently received several requests for my kit and so I am making it available here. It is free to try.
    If you like it please donate. For use in commercial projects a donation is required to licence.
    Pay what you think is fair :)


    Click here to donate: https://www.paypal.com/cgi-bin/webs...onationsBF:btn_donateCC_LG.gif:NonHostedGuest

    Download here: https://dl.dropboxusercontent.com/u/87201649/ForceFeedbackToolkit.unitypackage


    Force feedback adds a new dimension of realism to your game. It aids in the immersion factor and helps draw the player into the game. Let the player feel every bump on the road, or pull against the G-Forces in a flight simulator.

    $ff main.jpg

    This toolkit is fully compatible with Unity Free.

    Features include:

    • Force Effects Functions: Bumpy Road, Slippery Road, Damper, Dirt Road, Front Collision, Side Collision, Spring Force, Airbourne, Constant Force
    • Support for 2 dimensional force feedback joysticks.
    • Support for rumble on gamepads,
    • Support for up to 4 devices simultaneously
    • Example code to get you started integrating with popular vehicle packages: Unity Car, Edy's vehicle Physics, Car Tutorial
    • LED Support. Light up those LED lights on your Logitech G27.
    • Sample Scene: A sample scene is included that allows you to connect up to 4 force feedback game controllers and play a simple game.
    • Input Mapping for Vehicles: Included is a GUI to map input keys for Vehicles using direct input.
    • Instruction booklet: View attachment $FFB Instructions V1.0.pdf

    ** Only for Windows PC's and requires DirectX 9.0https://www.paypal.com/cgi-bin/webs...onationsBF:btn_donateCC_LG.gif:NonHostedGuest
     

    Attached Files:

    Last edited: Feb 28, 2014
  2. Tortyfoo

    Tortyfoo

    Joined:
    Mar 6, 2012
    Posts:
    132
    Not writing a racing game but if I was this would definitely be something of interest if the price was reasonable say $30-$40.
     
  3. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    Great !! Sure i'd like to see this on asset store.
    Is it compatible with unitycar ?
     
  4. KatanaSim

    KatanaSim

    Joined:
    Oct 25, 2009
    Posts:
    105
    I'd be happy to purchase this as soon as it hits the asset store.
     
  5. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Thanks for feedback.

    Yes I have a controller for unitycar, it will plug straight in. I haven't integrated it with car turorial or edy's yet.
     
  6. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    so i will definitly buy this :)
    have you got idea about the price ?
     
  7. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I haven't finalised price yet and I still haven't packaged it up for the store. If you would like a copy now I would be happy to sell you a copy directly at a low price. I'll send you a personal message, if interested just get back to me.
     
  8. rifter

    rifter

    Joined:
    Jan 1, 2013
    Posts:
    7
    i'm interested too and would be interested also by the same toolkit for force feedback joysticks (like the old -but still very good- Sidewinder FF2)
    would it be easily feasible ?
     
  9. PaulR

    PaulR

    Joined:
    Nov 14, 2012
    Posts:
    43
    Is this only for wheels or will it work with other controllers, like flight sticks, rumble etc...?
     
  10. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    +1 ?
     
  11. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Rumble works on 360 controllers.

    At the moment FFB is only on one axis. It shouldn't be difficult to add a function to apply force on 2nd Axis of joysticks.

    Thanks for input, I will work on including this feature in the initial release.

    I am finalising integration with Edy's Vehicle Physics and Unity Car Tutorial. I am hoping to make this available on asset store mid February.
     
  12. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I have made good progress in the last week:
    - Example code for adding force feedback to Car Tutorial (Alternative Physics Model) is now complete
    - Example code for adding force feedback to Edy's Vehicle Physics is now complete
    - Example code for adding force feedback to Unity Car is now complete
    - Force feedback on flight sticks with 2 force axis is complete
    - Support for multiple game controllers is complete. e.g. If your game has a split screen mode you could use 2 or even 4 XBox controllers (with rumble of course)

    I just have a bit of documentation left to do. I am hopeful I can submit the package to the Asset store in about a week. As soon as this is ready, I will send the new package to those kind people that purchased a pre-release version.

    Any other feature suggestions would be very welcome.

    All devices that are compatable with XInput and DInput should work. Including:

    Logitech G27,
    Logitech DRIVING_FORCE_GT,
    Logitech G25,
    Logitech MOMO_RACING,
    Logitech MOMO_FORCE,
    Logitech DRIVING_FORCE_PRO,
    Logitech DRIVING_FORCE,
    Logitech NASCAR_RACING_WHEEL,
    Logitech FORMULA_FORCE,
    Logitech FORMULA_FORCE_GP,
    Logitech FORCE_3D_PRO,
    Logitech EXTREME_3D_PRO,
    Logitech FREEDOM_24,
    Logitech ATTACK_3,
    Logitech FORCE_3D,
    Logitech STRIKE_FORCE_3D,
    Logitech G940_JOYSTICK,
    Logitech G940_THROTTLE,
    Logitech G940_PEDALS,
    Logitech RUMBLEPAD,
    Logitech RUMBLEPAD_2,
    Logitech CORDLESS_RUMBLEPAD_2,
    Logitech CORDLESS_GAMEPAD,
    Logitech DUAL_ACTION_GAMEPAD,
    Logitech PRECISION_GAMEPAD_2,
    Logitech CHILLSTREAM
     
  13. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Nice.

    Confirmation that it works with the Saitek X52 FCS (HOTAS) will be good ;).
     
  14. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Hi ZJP, Nice Joystick. I wish I had one of those :)

    I expect it should work. But I can't confirm unless I can get my hands on one.

    If you would like to test. The first message in this thread includes an early version of the toolkit. It only has left/right forces, but if these work, and the input mapping works ok, then I can guarantee the final release will work.
     
  15. Alex_V

    Alex_V

    Joined:
    Jun 25, 2012
    Posts:
    53
    A-ha finally!! Thanks for doing this, hoping to see it on Asset Store soon :)
     
  16. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    Ok, I guess I will purchase your asset in order to use it with UnityCar. Generally I think this is a great addition to Unity for every game you may want to play with a joystick/gamepad/steering wheel !
     
  17. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I have submitted the package to the asset store. Hopefully it will be available within the week.

    I included a very simple game in the package that demonstrates how to use multiple controllers, force feedback and direct input.

    For anyone interested here is the documentation: View attachment $FFB Instructions V1.0.pdf
     
    Last edited: Feb 2, 2013
  18. sesamiam

    sesamiam

    Joined:
    Jun 13, 2012
    Posts:
    87
    I recommend this to all Unitycar users (and of course everyone else). I´ve been able to test it and felt best so far from the available solutions.
     
  19. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I have had a slight delay getting this onto the asset store. They want want me to move the sample integration packages I have for unity car/edy's vehicle physics/car tutorial out of a sub-directory in "Standard Assets". Hopefully will be available soon.
     
    Last edited: Feb 25, 2013
  20. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
  21. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
  22. Yusuf-AKDAG

    Yusuf-AKDAG

    Joined:
    May 13, 2009
    Posts:
    280
    Hey man,
    What is the requirements of the integration to my Vehicle Physics package?
     
    Last edited: Feb 28, 2013
  23. Silberpfeile

    Silberpfeile

    Joined:
    Dec 11, 2012
    Posts:
    29
    just have bought this great stuff... going to try it tomorrow with carTutorial_alternative physics!! im so excited....
     
  24. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    The Asset Store link in broken. The product doesn't exist anymore. Why? :(
     
  25. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    HI ZJP, I decided to the pull asset from store because Logitech released a toolkit for Unity which essentially does what mine does. I was disappointed when their toolkit was released, as I put a fair bit of effort into the development. However, I couldn't in good conscience sell my toolkit when logitech's is free and does the same thing.

    Here is the link for the logitech toolkit: https://www.assetstore.unity3d.com/#/search/Logitech
     
  26. sesamiam

    sesamiam

    Joined:
    Jun 13, 2012
    Posts:
    87
    That kinda sucks. I would prefer to give my support for independent developer (which I have done though).

    Does this logitechs toolkit support other than logitechs own products?

    Im sure support would be better for your product. Maybe you could start "selling" your services to set up FFB for games? I might need that kind of service in near future since I really dont have much time to do it myself :)
     
  27. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    @Zaddo67
    Bad. :(
    Proposed your pack with source as free (or PayPal donate). ;)

    Good question.

    You can be sure that Logitech's guys don't haunt the Unity forums. :p

    That said, i'm working on a solution (DLL) with SDL 2.0

    JP
     
    Last edited: Mar 20, 2013
  28. mihalski

    mihalski

    Joined:
    Apr 4, 2013
    Posts:
    2
    Based on the package contents of the Logitech SDK it doesn't include support for joysticks so I think there may still be a place for your pack on the asset store as I was unable to find any alternatives.

    I was hoping on learning Unity by building a simple space combat sim and using my Microsoft Sidewinder 2 FF once I get my Oculus Rift.

    BTW, I'm in Brisbane too. Good to see some locals here :)
     
  29. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Thx for feedback. I thought the logitech toolkit supports joysticks. Just not the forcefeedback?

    BTW, there is a user group in Brisbane on 6th of May, thought you might be interested: http://www.meetup.com/Brisbane-Unity-Developers/events/113429512/?a=wm1_5&rv=wm1
     
  30. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    I just got this Force Feedback Plugin this from Zaddo67 and it works perfectly. I had to integrate it into my car physics but its working fine now and no crashes like the Vectrex plugin. I wish I would have found this years ago.

    I urge people to support this..... as i have been doing force feedback on Unity for 2 years now and this is BY FAR the most polished kit available on Unity. The Direct Input support is FANTASTIC and very similar to the Logitech SDK.

    Again I believe he has removed it from the Asset store but I did get it right from him.

    Kevin
     
  31. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    There is no link on the Asset Store... where have you got the copy?
     
  32. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Hi ZJP, I took it off the Asset store because Logitech published their own solution, I felt their asset made mine obsolete.

    Here is a link to the package, free for personal use. If you want to use this asset for a published game, please PM me for a commercial licence.


    [Edit] Download link is now on first entry in this thread.
     
    Last edited: Feb 28, 2014
  33. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    please make a donate button..... you deserve it....:)

    This is a complete well documented solution to a problem many Unity users are facing. I did download the SDK from logitech and this is much easier and "ready" to intgrate into UnityCar, Car Tutorial and Edys physics.

    Sorry to cause you extra work if you were done with this..... i just know how long i looked for a solution....lol.

    Kevin
     
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Link broken.
     
  35. Tortyfoo

    Tortyfoo

    Joined:
    Mar 6, 2012
    Posts:
    132
    Download thread worked fine for me. Maybe try again?
     
  36. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    Thanks Kevin for your support. I have put a donate button on the first entry of this thread. It would be great if this asset is useful for others (It did take a lot of time to develop :) )
     
  37. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    For Unity Car users.

    This is a simplified example for force feedback integration.

    Download scritps:
    https://dl.dropboxusercontent.com/u/87201649/FFBonly.zip

    FFBOnly.cs
    FFBOnlyController.cs

    Instructions:

    Step 1: A small modifation is required to CarController.cs. veloKmh must be made public:
    float veloKmh; to public float veloKmh;

    Step 2: Import the FFB controller package into a UnityCar project. (See first entry of this thread to download)

    Step3: The FFB Controller package includes a file UnityCar.zip. Unzip the contents of this into your project. These can be placed in any folder except a folder in or under Standard Assets.

    Step 4: Copy FFWheelInput.dll from FFB Folder to root folder of project (i.e. parent folder of Assets)

    Step 5: Unzip the FFBonly.zip file on this email and place scripts in the same folder you placed the UnityCar.zip scripts in Step3.

    Step 5: Add FFBOnlyController.cs to any object in your scene that doesn't get destroyed.

    Step 6: Add FFBOnly.cs to your vehicle

    Step 7: On vehicle enable forcefeedback on carDynamics script

    When you drive the car you should now feel the force feedback. There are a couple things you might need to do

    1. These scripts will pick up the first game controller connected to the PC. If you want to allow the user to select which controller they want to use when multiple controllers are attached, some coding will be required.
    2. In FFBOnly.cs, there is a constant in the call to SetForceCoordinate of -1.8. You will need to adjust this to set the strength of force feedback. And for some devices you will need to change this to a positive number as Force feedback may be inverted.
     
    Last edited: Feb 28, 2014
  38. H_Hazuki

    H_Hazuki

    Joined:
    Apr 4, 2013
    Posts:
    37
    Hi there,

    I'm currently making a driving simulator for use in education, here's a YouTube video that should give you an idea of how it's shaping up:


    The thing is, i'm making the whole thing myself and have no coding knowledge at all, everything's been done using visual scripting tool Playmaker.

    I'd really like to use this FFB toolkit and have imported it into the project but I don't understand it. I can bring up the menu and tick the boxes to make the wheel rumble which is great.

    I only want to do something very simple, just attach scripts to turn on 'bumpy road', 'dirt road' etc. by attaching them to empty game objects and activating them or deactivating them through Playmaker when the player passes through triggers.

    I'd really appreciate any help and if that happens to be from the maker of FFBtoolkit I'll gladly donate!
     
  39. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    HI Charming_fox.

    Your sim looks great!!

    I would love to help, but unfortunately I don't have much spare time.

    My FFB package is a developers tool kit and it will take several hours coding to hook up with your game the way you describe. If you are interested in learning some coding, the documentation, example game and integration with other driving packages will help you.

    All the best, I hope your project goes well.

    Tony
     
  40. H_Hazuki

    H_Hazuki

    Joined:
    Apr 4, 2013
    Posts:
    37
    Thanks for the quick reply, and for the saying the sim looks good!

    If you do have a couple of spare minutes, and please tell me if you don't! Would you be kind enough to tell me if the following is easy and perhaps a few pointers?

    When I press the M key I get the menu and all works ok.
    What would a C#script look like that just activates 'bumpy road'? In my head it is just a couple of lines of code, but I'm really, really not a programmer.

    Basically, all I'm after is when the player turns the ignition key in the car the wheel begins to rumble, I'm not fussed about anything more, that on it's own would be great!

    Again, thanks for the reply already and I understand if you're busy, plus, thanks for writing the plugin in the first place.

    Cheers
    A
     
  41. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    The best place to start would be to follow the steps on Page 4 of the instruction PDF under "Your own Game", This gives you the steps on how to integrate the package into your project.

    To see how to turn on and off effects. Take a look at the FFTest method in WheelMenu.cs. This is the code that is run to test effects from the test menu.

    For example, the code for bumpy road is:

    Code (CSharp):
    1.         bumpyRoad = GUI.Toggle(ffRect[p], bumpyRoad, "Bumpy Road");
    2.         if (bumpyRoad != oldBumpyRoad)
    3.         {
    4.             if (bumpyRoad) dinput.PlayBumpyRoadEffect(50);
    5.             else dinput.StopBumpyRoadEffect();
    6.             oldBumpyRoad = bumpyRoad;
    7.         }

    so in your code, the code to turn on bumpy road is:
    Code (CSharp):
    1. dinput.PlayBumpyRoadEffect(50);
    Change 50 to adjust the strength of the effect. You wanted the wheel to vibrate when they start the car, so try a small value, eg: 10.

    and turn it off, it is:
    Code (CSharp):
    1. dinput.StopBumpyRoadEffect();
    This of course is C#.

    I hope this helps.

    Best of luck.

    Tony
     
  42. H_Hazuki

    H_Hazuki

    Joined:
    Apr 4, 2013
    Posts:
    37
    Thank you, I'm sure it will, again, you're a star!
     
  43. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    Unfortunately, it appears that this code has depreciated. Importing the package into a clean project I receive this error:

    NullReferenceException: Object reference not set to an instance of an object
    FFBGame.Start () (at Assets/ForceFeedbackToolkit/ForceFeedbackToolkit Samples/MultipleControllers/FFBGame.cs:24)

    I've tried several methods, but there is always an issue with reference to the WheelInput singleton.
     
  44. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    HI Huxley,

    I am sorry you having problems with my asset. I tried the package I have linked in the the original post of this thread in 4.3 and 4.5 and it still works as expected for me. It must be an environmental problem.

    My thoughts are:
    - What OS are you using? I tested on Win7 & Win8.
    - Has FFWheelInput.dll been copied to root directory of project (Parent of Assets)
    - The line you refer to uses the WheelMenu component on camera. I can't see why this would be missing, but double check component WheelMenu is on the camera.
    - The WheelInput singleton is created in the Awake method of WheelMenu, when the Instance is first referenced. If there is an issue, it should send the message "Error instantiating WheelInput" to console. Do you see this message?
    - Perhaps there is a problem instantiating the WheelInput instance. I have try catch here, but I don't post any errors if they occur. Try changing the code so that it outputs any errors to console, as per code below, changes are in the catch.
    - One last thought. My package uses DirextX 9. I have come across some systems where this needed to be installed.
    http://www.microsoft.com/en-us/download/details.aspx?id=8109


    Code (CSharp):
    1.     private static WheelInput instance;
    2.     public static WheelInput Instance
    3.     {
    4.         get
    5.         {
    6.             if (instance != null) return instance;
    7.             else
    8.             {
    9.                 try
    10.                 {
    11.                     // Create singlton
    12.                     instance = new WheelInput();
    13.  
    14.                     // Connect to gaming device
    15.                     if (DWheel.InitDirectInput())
    16.                     {
    17.                         instance.LoadSettings();
    18.                         return instance;
    19.                     }
    20.                     else return null;
    21.                 }
    22.                 catch (Exception ex)
    23.                 {
    24.                     MonoBehaviour.print(ex.Message);
    25.                     return null;
    26.                 }
    27.  
    28.             }
    29.         }
    30.     }
     
    Last edited: Aug 9, 2014
  45. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    This was entirely my fault. I had placed the .dll in my assets root, not the project root as required. Thanks for your quick support.
     
  46. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    HI Huxley. Thanks for posting all is ok. I am glad you got it working.
     
  47. KuraLemot

    KuraLemot

    Joined:
    Aug 21, 2014
    Posts:
    5
    Hi Zaddo67,

    I am newbie in unity
    your toolkit is very great. I use it in my project and it working nicely...
    but when I build my project, the toolkit not work ....
    I tried to build FFB scene and I get "Force Feedback unavailable....".

    can you help me about my problem ?
     
  48. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    HI KuraLemot, Thanks for the complement :)

    You just need to have the FFWheelInput.dll in the same directory as the .exe you build.
     
  49. KuraLemot

    KuraLemot

    Joined:
    Aug 21, 2014
    Posts:
    5
    thanks for very quick reply :)

    I've tried that but I get the same problem ...

    Capture.PNG Capture2.PNG
     
  50. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    This is most confusing. I can't think of any reason you would be having this issue. I'll have to investigate. I am at work now, I'll have a look when I get home tonight.

    Edit: Also, can you let me know what version of Windows you are on.
     
    Last edited: Aug 22, 2014