Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
andchang's avatar
andchang
Honored Guest
11 years ago

DK2 + "Get Positional Tracking Camera Parameters" function

I'm trying to draw the DK2's positional tracking camera's bounding volume in the 3D space with a wire frame so the user can know where they can safely walk around the VR environment.

Does anyone have a sample Blueprints/C++ function that does this? Thanks!

6 Replies

Replies have been turned off for this discussion
  • artyom17's avatar
    artyom17
    Expert Protege
    Just FYI: you can visualize it via 'hmdpos showcamera' console command (for debugging purposes). To get the idea how it works you may have a look into FOculusRiftHMD::DrawDebugTrackingCameraFrustum C++ function (in OculusRiftHMD.cpp) Would be nice if anybody has a BP example for that too.
  • spyro's avatar
    spyro
    Expert Protege
    "Get Positional Tracking Camera Parameters" seems still broken (UE 4.8). Can't get the position of the camera relative to the user's head...

    Would love to create something like a tracking volume visualization if the users comes too close to the borders.
  • artyom17's avatar
    artyom17
    Expert Protege
    Have you tried 'hmddbg showcamera' console command? That should draw the desired volume.
  • spyro's avatar
    spyro
    Expert Protege
    "artyom17" wrote:
    Have you tried 'hmddbg showcamera' console command? That should draw the desired volume.


    Yes, that works (altough it crashes the engine when I exit the game without disabling it before).

    But that's not what I want. I'd like to draw a wire frustum when the user gets too near to the tracking boundaries, similar to this in Titans Of Space (ideally, this should be built-in into the composer right away).

    spyro
  • artyom17's avatar
    artyom17
    Expert Protege
    I'll check the crash.
    The 'hmddbg showcamera' just proves that "Get Positional Tracking Camera Parameters" works correctly, since this is what it uses. You just need to translate, scale and rotate (probably) it. You can use FHeadMountedDisplay::DrawDebugTrackingCameraFrustum C++ method (from HeadMountedDisplayCommon.cpp) as an example of using it.