Announcement

Collapse
No announcement yet.

Vive Tracker - Can be tracked in editor?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Vive Tracker - Can be tracked in editor?

    Hello there,
    I know it is possibile to have the Vive Tracker to be tracked in editor, without Play or Simulate, but I can't figure out how to achieve this.
    I use Unreal for Virtual Production purpose and I need the Vive Tracker to drive a VCam, possibily without hitting Play.
    Thx

    #2
    Good question....for body mocap I use IKinema Orion, which is a standalone software that gets the Vive Trackers position and send it to UE4, and it does work without being in either Play/Simulate.
    I think that you can do the same thing, but using the data coming from SteamVR, but honestly I haven't found any usefull informations as well.

    May I ask why you need it to work without being in Play/Simulate?
    Because having a Vive Tracker onto a camera is very easy to integrate and use in Virtual Production.
    ENTER REALITY

    VR Solutions

    Contact us for more informations

    Comment


      #3
      I was really curious so I tested it. Yes, it's possible, but with a bit of C++ (only to make it Tick in editor, not to get coordinates of vive tracker).
      https://youtu.be/pwhR1Bw5GsM

      This isn't 100% working code, you need to use multiple static mesh components and bind them to device IDs, but I hope it gives an idea.

      Header:
      Code:
      #pragma once
      
      #include "CoreMinimal.h"
      #include "GameFramework/Actor.h"
      #include "ViewportTicker.generated.h"
      
      UCLASS()
      class VIVEMOCAP_API AViewportTicker : public AActor
      {
          GENERATED_BODY()
      
      public:    
          AViewportTicker();
          virtual void Tick(float DeltaTime) override;
      
          UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = "Components")
          class UStaticMeshComponent* TrackerMesh;
      
          virtual bool ShouldTickIfViewportsOnly() const override
          {
              return true;
          }
      };
      Source:
      Code:
      #include "ViewportTicker.h"
      #include "Components/StaticMeshComponent.h"
      #include "SteamVRFunctionLibrary.h"
      
      AViewportTicker::AViewportTicker()
      {
          PrimaryActorTick.bCanEverTick = true;
          PrimaryActorTick.bStartWithTickEnabled = true;
      
          RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
      
          TrackerMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TrackerMesh"));
          TrackerMesh->SetupAttachment(RootComponent);
      
      }
      
      void AViewportTicker::Tick(float DeltaTime)
      {
          Super::Tick(DeltaTime);
      
          TArray<int32> DeviceIds;
          TArray<int32> TrackerIds;
          USteamVRFunctionLibrary::GetValidTrackedDeviceIds(ESteamVRTrackedDeviceType::Controller, DeviceIds);
          USteamVRFunctionLibrary::GetValidTrackedDeviceIds(ESteamVRTrackedDeviceType::Other, TrackerIds);
          DeviceIds.Append(TrackerIds);
      
          if (DeviceIds.Num() > 0)
          {
              FVector loc;
              FRotator rot;
              USteamVRFunctionLibrary::GetTrackedDevicePositionAndOrientation(DeviceIds[0], loc, rot);
              TrackerMesh->SetRelativeLocationAndRotation(loc, rot);
          }
      }
      Stand-alone mocap app for Vive Trackers: vrmocapstudio.com
      Marketplace: Vive Mocap Kit / Fingers Solver / VR IK Body Solver / Subtitles to LipSync / Dialogue System with Character Animation
      And random stuff at Youtube

      Comment


        #4
        Originally posted by Enter Reality View Post
        Good question....for body mocap I use IKinema Orion, which is a standalone software that gets the Vive Trackers position and send it to UE4, and it does work without being in either Play/Simulate.
        I think that you can do the same thing, but using the data coming from SteamVR, but honestly I haven't found any usefull informations as well.

        May I ask why you need it to work without being in Play/Simulate?
        Because having a Vive Tracker onto a camera is very easy to integrate and use in Virtual Production.
        I am building a muticamera setup, that streams to a video mixer via Blackmagic. I use the new features of Composure, and is very handy to have all functioning in editor, for production reasons.

        Comment


          #5
          Originally posted by YuriNK View Post
          I was really curious so I tested it. Yes, it's possible, but with a bit of C++ (only to make it Tick in editor, not to get coordinates of vive tracker).
          https://youtu.be/pwhR1Bw5GsM

          This isn't 100% working code, you need to use multiple static mesh components and bind them to device IDs, but I hope it gives an idea.
          Thank you, i'll check this. I am not a programmer, so I don't think i'll understand everything. Also a cinecamera must be parented to the tracker, so I think i'll need coordinates to make this useful.
          Any chance this thing can be done or explored using blueprints? I understand a little coding, but it is beyond my skills to really use it in production.

          Comment


            #6
            FabioA
            You can get tracker's coordinates in blueprint using the same two functions: GetValidTrackedDeviceIds and GetTrackedDevicePositionAndOrientation. But Tick event doesn't work in viewport without simulation mode unless ShouldTickIfViewportsOnly function returns true. And you can only override ShouldTickIfViewportsOnly function in c++.

            Probably you can use Python instead to extend editor's functionaliy - but i'm not sure.
            Stand-alone mocap app for Vive Trackers: vrmocapstudio.com
            Marketplace: Vive Mocap Kit / Fingers Solver / VR IK Body Solver / Subtitles to LipSync / Dialogue System with Character Animation
            And random stuff at Youtube

            Comment


              #7
              Originally posted by FabioA View Post
              So, I added this functionality to my helper mini-plugin. You can download it here, then copy to [your project]/Plugins folder or [engine version]/Engine/Plugins/Marketplace.
              In your project, create blueprint inherited from "Editor SteamVR Controller" and place it on level, then in Details panel add any objects to "Tracked Objects" map. Good luck!

              Click image for larger version

Name:	001.jpg
Views:	358
Size:	297.7 KB
ID:	1675787
              Stand-alone mocap app for Vive Trackers: vrmocapstudio.com
              Marketplace: Vive Mocap Kit / Fingers Solver / VR IK Body Solver / Subtitles to LipSync / Dialogue System with Character Animation
              And random stuff at Youtube

              Comment


                #8
                Originally posted by YuriNK View Post
                So, I added this functionality to my helper mini-plugin. You can download it here, then copy to [your project]/Plugins folder or [engine version]/Engine/Plugins/Marketplace.
                In your project, create blueprint inherited from "Editor SteamVR Controller" and place it on level, then in Details panel add any objects to "Tracked Objects" map. Good luck!

                Click image for larger version

Name:	001.jpg
Views:	358
Size:	297.7 KB
ID:	1675787
                Thank you very much! I'll try today and i'll let you know.

                Thank you again!​​​​​​​

                Comment


                  #9
                  If you needed lastest version:
                  • open my ViveMocapKit page on Marketplace (link in my signature)
                  • download "Demo Project (for motion capture)" (it won't work without ViveMocapKit plugin, but you don't need it)
                  • extract and copy ViveMocap/Plugins/SteamVRTrackingLib to you project's "Plugins" folder.
                  Stand-alone mocap app for Vive Trackers: vrmocapstudio.com
                  Marketplace: Vive Mocap Kit / Fingers Solver / VR IK Body Solver / Subtitles to LipSync / Dialogue System with Character Animation
                  And random stuff at Youtube

                  Comment

                  Working...
                  X