baileyange Posted April 27, 2015 Share Posted April 27, 2015 Hi everyone,I am new to Torque3D.We have developed a input device simillar to Oculus, and we want to add our input's SDK to Torque3D so the game created by Torque3D would work with our device.I would like to know how to add out SDK.I check the current version (3.7) which supports Leapmotion, and Oculus. However, I am blocked at some points when reading the codes. I would like to know a general way, or steps, then I can learn it myself. But I dont know where to start.Hope somebody can help me, and thx in advance. Quote Link to comment Share on other sites More sharing options...
buckmaster Posted April 27, 2015 Share Posted April 27, 2015 @LukasPJ added support for the Myo - he's the last person I can think of to add a completely new device. You might pester him to give you a run-down, or at least share the code. Quote Link to comment Share on other sites More sharing options...
baileyange Posted April 27, 2015 Author Share Posted April 27, 2015 @LukasPJ added support for the Myo - he's the last person I can think of to add a completely new device. You might pester him to give you a run-down, or at least share the code. Thanks, I will contact him. Quote Link to comment Share on other sites More sharing options...
buckmaster Posted April 27, 2015 Share Posted April 27, 2015 Oh, and - welcome to Torque! Quote Link to comment Share on other sites More sharing options...
LukasPJ Posted April 27, 2015 Share Posted April 27, 2015 I never did finish the Myo implementation (biggest issue was that it was queueing data when game was minimized) but you can find my implementation here.Alternately I simplified it to show the gist of it here. (Untested code)I am by no means a guru of input devices, so I'm not much of a help, but that should give you somewhere to begin. What I did was to simply copy and paste the LeapMotion code, and replace the all the Leap stuff (you'll find residue in there though because I never cleaned it properly).Edit:That should, btw, bind "orientation" to the "xxx" device, used like this in TorqueScript:moveMap.bind( xxx, orientation, orientationReceived);Example:function printOrientation(%roll, %pitch, %yaw, %angle) { echo(%roll SPC %pitch SPC %yaw SPC %angle); } GlobalActionMap.bind(xxx, orientation, printOrientation); Quote Link to comment Share on other sites More sharing options...
baileyange Posted April 28, 2015 Author Share Posted April 28, 2015 I never did finish the Myo implementation (biggest issue was that it was queueing data when game was minimized) but you can find my implementation here.Alternately I simplified it to show the gist of it here. (Untested code)I am by no means a guru of input devices, so I'm not much of a help, but that should give you somewhere to begin. What I did was to simply copy and paste the LeapMotion code, and replace the all the Leap stuff (you'll find residue in there though because I never cleaned it properly).Edit:That should, btw, bind "orientation" to the "xxx" device, used like this in TorqueScript:moveMap.bind( xxx, orientation, orientationReceived);Example:function printOrientation(%roll, %pitch, %yaw, %angle) { echo(%roll SPC %pitch SPC %yaw SPC %angle); } GlobalActionMap.bind(xxx, orientation, printOrientation); Thanks, I will chek it. Quote Link to comment Share on other sites More sharing options...
baileyange Posted April 28, 2015 Author Share Posted April 28, 2015 I never did finish the Myo implementation (biggest issue was that it was queueing data when game was minimized) but you can find my implementation here.Alternately I simplified it to show the gist of it here. (Untested code)I am by no means a guru of input devices, so I'm not much of a help, but that should give you somewhere to begin. What I did was to simply copy and paste the LeapMotion code, and replace the all the Leap stuff (you'll find residue in there though because I never cleaned it properly).Edit:That should, btw, bind "orientation" to the "xxx" device, used like this in TorqueScript:moveMap.bind( xxx, orientation, orientationReceived);Example:function printOrientation(%roll, %pitch, %yaw, %angle){ echo(%roll SPC %pitch SPC %yaw SPC %angle);}GlobalActionMap.bind(xxx, orientation, printOrientation);[/quote]I ckecked the code, It helps a lot. But, in fact I am not sure about the whole work flow. I list here what I found, but I don't know if it is correct: 1. First to exctue the new input device Torquescript: in "game\core\scripts\client\core.cs": // Input devices exec("~/scripts/client/oculusVR.cs");2. In "game\core\scripts\client\oculusVR.cs" define functions are defined such as:..... function enableOculusVRDisplay(%gameConnection, %trueStereoRendering) { setOVRHMDAsGameConnectionDisplayDevice(%gameConnection); PlayGui.renderStyle = "stereo side by side"; if(%trueStereoRendering) { if($pref::OculusVR::UseChromaticAberrationCorrection) { OVRBarrelDistortionChromaPostFX.isEnabled = true; } else { OVRBarrelDistortionPostFX.isEnabled = true; } } else { OVRBarrelDistortionMonoPostFX.isEnabled = true; } // Reset all sensors ovrResetAllSensors(); } ........ 3. in the code of step 2, some existing functions such as "setOVRHMDAsGameConnectionDisplayDevice", is defined in "Engine\source\platform\input\oculusVR\oculusVRDevice.cs": DefineEngineFunction(setOVRHMDAsGameConnectionDisplayDevice, bool, (GameConnection* conn),, "@brief Sets the first HMD to be a GameConnection's display device\n\n" "@param conn The GameConnection to set.\n" "@return True if the GameConnection display device was set.\n" "@ingroup Game") { if(!ManagedSingleton<OculusVRDevice>::instanceOrNull()) { Con::errorf("setOVRHMDAsGameConnectionDisplayDevice(): No Oculus VR Device present."); return false; } if(!conn) { Con::errorf("setOVRHMDAsGameConnectionDisplayDevice(): Invalid GameConnection."); return false; } conn->setDisplayDevice(OCULUSVRDEV); return true; } 4. in the code of step 2, the defined functions are used in different torquescripts Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.