1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Generic unity plugin

Discussion in 'SimTools Plugins' started by narthur157, Dec 16, 2015.

  1. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    Hey I'm thinking about writing a Unity plugin that can be downloaded from the assets store for people who want to easily add simtools support to their games.

    Did some quick searches and didn't find anything, has anybody done something like this?

    What I'm looking to make is a script that you can attach to any Unity game object which will then export telemetry data to simtools. If this is successful, I will later try to do the same for Unreal Engine.

    Looking to do this for some potential games I will be making but to also open source it and such since I'm a comp sci student.

    Thoughts?
    • Like Like x 3
    • Winner Winner x 2
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. value1

    value1 Nerd Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,175
    Location:
    Zug, Switzerland
    Balance:
    9,065Coins
    Ratings:
    +3,218 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    • Agree Agree x 1
  4. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    I'm a continent away from my JRK's and my motion sim right now, is there a way to test game output without actually having a JRK connected? Either a way to make my computer think there's a JRK, or just something that shows game input in simtools? I want to test my UDP communication.

    This looks quite simple to implement.

    EDIT: Just remembered virtual axis...
  5. value1

    value1 Nerd Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,175
    Location:
    Zug, Switzerland
    Balance:
    9,065Coins
    Ratings:
    +3,218 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Use an existing COM-port as "interface", that's enough.
  6. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    I've verified that I'm definitely sending out data via udp packets (verified via wireshark) to 127.0.0.1 on port 4123, but still no movement on the virtual axis.

    I'm not sure how to debug this...I'm not sure if it's just my simtools config that's messed up, if the packets are not being received by simtools, or if the format is not working.
  7. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    I made a dump of the process and I don't see that GameEngine is using the Unity.dll module I made, yet I set it in game manager and 'patched' the game (which does nothing essentially, but seems to enable the plugin)

    EDIT: It's possible that my config is messed up because this computer hasn't had the JRK plugged in so the COM ports are unavailable? I'm using the NET interface with a bogus config
    Last edited: Dec 16, 2015
  8. value1

    value1 Nerd Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,175
    Location:
    Zug, Switzerland
    Balance:
    9,065Coins
    Ratings:
    +3,218 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    The data you send from the unity module must be received by a plugin for SimTools.
    You could send the Unity data in the same format as LFS does and modify the LFS plugin.
  9. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    I basically did this, except I reduced the data down to a single value, X position.
  10. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    Update: After mucking with config, I was able to send some roll data. Now it's just a matter of adding all the other axis. I'll upload the code to github soon
    • Like Like x 5
    • Winner Winner x 2
  11. jangomoose

    jangomoose Member

    Joined:
    Jun 18, 2015
    Messages:
    105
    Location:
    Hobart, Australia
    Balance:
    784Coins
    Ratings:
    +55 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    This would be really useful, how's it going?
    • Agree Agree x 1
  12. jangomoose

    jangomoose Member

    Joined:
    Jun 18, 2015
    Messages:
    105
    Location:
    Hobart, Australia
    Balance:
    784Coins
    Ratings:
    +55 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Any updates?
  13. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    15,368
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    112,969Coins
    Ratings:
    +9,090 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    @narthur157 was last around about a week ago, so hopefully we get some info next time around.

    It would be exceedingly useful to have a Unity Plugin, I would be keen to give it a go with a custom driving experience rather than mod some existing games as I do now.
  14. digital

    digital New Member

    Joined:
    Apr 9, 2016
    Messages:
    4
    Location:
    London, UK
    Balance:
    256Coins
    Ratings:
    +2 / 0 / -0
    @narthur157 Any movement on this? I'm looking to add support to my Unity project.
  15. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    15,368
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    112,969Coins
    Ratings:
    +9,090 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    @narthur157 has not been around since earlier in March, hopefully the unity plugin project will progress when @narthur157 has more time.
  16. narthur157

    narthur157 Member

    Joined:
    Mar 8, 2015
    Messages:
    31
    Balance:
    230Coins
    Ratings:
    +30 / 0 / -0
    Here's my progress, it's not too much, but it is a successful proof of concept. https://github.com/narthur157/motion-sim

    It only gives one axis of something, I forget what. But it's just a matter of exporting the other data.

    Looking at it now though, I think I forgot to add the Unity script, woops...But it just sends UDP packets to localhost to the port given in the plugin for each axis and such.
    • Winner Winner x 1
  17. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    15,368
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    112,969Coins
    Ratings:
    +9,090 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    I am so pleased you got to the proof of concept stage, I have bookmarked your work to have a little look when I get a moment.

    Please do let us know when you include the script, I know @digital was following up on people's request to add motion to their game and the likes of @jangomoose and I are currently working on our own Unity based projects.
  18. RusPixel

    RusPixel New Member

    Joined:
    Mar 27, 2017
    Messages:
    1
    Location:
    Russia
    Balance:
    106Coins
    Ratings:
    +0 / 0 / -0
    Any idea for Unreal Engine?
  19. ferslash

    ferslash Active Member

    Joined:
    Feb 8, 2011
    Messages:
    492
    Balance:
    4,757Coins
    Ratings:
    +178 / 2 / -0
    man you rock !!! keep that nice work, :D (support is not much, but you have plenty of fans now) :D

    @noorbeast i guess you will have movement in your witch fly simulator (man i really liked the demos you uploaded that time)

    best regards to all

    fer
  20. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    15,368
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    112,969Coins
    Ratings:
    +9,090 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    The broomstick rides I did for my father's 85 birthday used a modified office chair and mount for the Vive wand, so did not have motion other than transducers. But that is the sort of things where it would be nice to have an easy way to include motion support.
    • Like Like x 1
    Last edited: Nov 13, 2017
  21. kjjcard

    kjjcard Member Gold Contributor

    Joined:
    May 15, 2017
    Messages:
    41
    Location:
    south korea
    Balance:
    330Coins
    Ratings:
    +5 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, 6DOF
    I found the DLL files for AdditionPlugin and PluginAPI in this project. I put it in the Plugins folder of Unity project and changed Unity to .NET 4.6 version. After that I want to use this project, but I do not know how to use this dll. My motion platform is 2DOF and I want to control both axes. Thank you.