Jump to content

baileyange

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by baileyange

  1. 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

  2. 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.

  3. 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.

×
×
  • Create New...