birarda / moveframework

Automatically exported from code.google.com/p/moveframework
2 stars 0 forks source link

Unity utilisation #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, first thanks for this awesome job !
And I don't know if I ask in the right place, but I wanted to know if someone 
has already use your framework in Unity, or do you know how can I integrate it ?

Hope you can help me ! 

Guillaume PIERRE

Original issue reported on code.google.com by guillaum...@gmail.com on 14 Nov 2013 at 4:06

GoogleCodeExporter commented 9 years ago
I have been working with this in Unity for the past couple of days just to mess 
around with it.  Thinking of using it with the Oculus (I'm sick of the Hydra's 
wires).  So far it works ok - I have some trouble getting the BallManager to 
get through creating balls for two Moves reliably though.

I had to do some work to get it working well in the unity editor also.  The C 
wrapper doesn't by default provide a way to shut down the moves and the camera 
(the demo apps rely on the objects going out of scope, when running in the 
editor the objects never go out of scope), so I had to add this functionality 
locally.  There are a couple of empty functions in MoveManager::closeMoves() 
and MoveManager::closeCamera() that need to be filled in.

Also, where to put which files can be a bit confusing, but I eventually figured 
out that the Unity Editor changes the working directory to the root directory 
of the project - this affected being able to parse the settings.cfg.

Here's a summary of how I've gotten it working so far:

Change to framework:

    completed code for MoveManager::closeMoves() and MoveManager::closeCamera()
    made MoveDevice::CloseMoves() reset MoveCount to 0
    Initialized global pointer in CWrapperMain::move to 0
    created new call in CWrapperMain __declspec(dllexport) void __stdcall deinit()
    Added new dllimport call in CSWrapper.cs to import CWrapperMain::deinit()
    Removed ".dll" in DllImport (for unity - otherwise unity can't find the dll

Where files need to go:

MF_CWrapper.dll -> Assets/Plugins

msvcp100.dll       -|
msvcr100.dll        |
hidapi.dll      |
CLEyeMulticam.dll   |
MoveManager.dll     --> ProgramFiles(x86)/Unity/Editor

if you use the calibration tool to make a settings.cfg file, it needs to go 
into the root folder for your project
For Example:
Documents/Unity/PSMoveOculusExperiment/settings.cfg

this is because _getcwd() when called in a dll from the unity editor will 
return the path to the project folder

Some work would need to be done if you wanted to distribute a build.  For 
example, you would want to add in the
ability to calibrate and save the resulting settings from the app which would 
require some work on the C wrapper.

Original comment by ddoubled...@gmail.com on 28 Dec 2013 at 6:04

GoogleCodeExporter commented 9 years ago
First thanks for this detailed response !
I have some question about your work, just to be sure of the process. So you 
first make changes to the visual project and so created new dll with your new 
code ?
And I wanted to know if it would be possible that you share an example of the 
wrapper use in unity ( a Unity C# script ) ?

I also works with the Oculus and want to try some interactions with thiq two 
accessories. I hadn't the time yet to completly get in the moveframeworks but 
your works will really help me ! And hope that you can respond to my questions 
=)
Thanks again !

Original comment by guillaum...@gmail.com on 28 Dec 2013 at 5:27

GoogleCodeExporter commented 9 years ago
So, since my last post it all stopped working.  Here is the question that I 
asked on Unity Answers with detailed information on the problem.

http://answers.unity3d.com/questions/606854/fallback-handler-could-not-load-libr
ary.html

Original comment by ddoubled...@gmail.com on 15 Jan 2014 at 4:02

GoogleCodeExporter commented 9 years ago
Does anybody have any news on Unity issue? I'm making a project now, and C# 
wrapper working in unity x86 build, not in the editor. What I can't fix is CL 
Eye driver - position tracking does not work in build at all. It's working fine 
in sample application though.

Original comment by cbrpnk...@gmail.com on 20 Mar 2015 at 8:27