void FSimpleHMD::GetCurrentOrientationAndPosition(FQuat& CurrentOrientation, FVector& CurrentPosition) { CurrentPosition = FVector(0.0f, 0.0f, 0.0f); GetCurrentPose(CurrentOrientation); CurHmdOrientation = LastHmdOrientation = CurrentOrientation; }
void FGearVR::GetCurrentOrientationAndPosition(FQuat& CurrentOrientation, FVector& CurrentPosition) { // only supposed to be used from the game thread check(IsInGameThread()); auto frame = GetFrame(); if (!frame) { CurrentOrientation = FQuat::Identity; CurrentPosition = FVector::ZeroVector; return; } //if (PositionScale != FVector::ZeroVector) //{ // frame->CameraScale3D = PositionScale; // frame->Flags.bCameraScale3DAlreadySet = true; //} const bool bUseOrienationForPlayerCamera = false, bUsePositionForPlayerCamera = false; GetCurrentPose(CurrentOrientation, CurrentPosition, bUseOrienationForPlayerCamera, bUsePositionForPlayerCamera); if (bUseOrienationForPlayerCamera) { frame->LastHmdOrientation = CurrentOrientation; frame->Flags.bOrientationChanged = bUseOrienationForPlayerCamera; } if (bUsePositionForPlayerCamera) { frame->LastHmdPosition = CurrentPosition; frame->Flags.bPositionChanged = bUsePositionForPlayerCamera; } }
void FSteamVRHMD::GetCurrentOrientationAndPosition(FQuat& CurrentOrientation, FVector& CurrentPosition) { check(IsInGameThread()); GetCurrentPose(CurHmdOrientation, CurHmdPosition); CurrentOrientation = LastHmdOrientation = CurHmdOrientation; CurrentPosition = CurHmdPosition; }
void FSteamVRHMD::PreRenderViewFamily_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneViewFamily& ViewFamily) { check(IsInRenderingThread()); GetActiveRHIBridgeImpl()->BeginRendering(); FVector CurrentPosition; FQuat CurrentOrientation; GetCurrentPose(CurrentOrientation, CurrentPosition, vr::k_unTrackedDeviceIndex_Hmd, true); }
void FSteamVRHMD::UpdatePlayerCameraRotation(APlayerCameraManager* Camera, struct FMinimalViewInfo& POV) { GetCurrentPose(CurHmdOrientation, CurHmdPosition); LastHmdOrientation = CurHmdOrientation; DeltaControlRotation = POV.Rotation; DeltaControlOrientation = DeltaControlRotation.Quaternion(); // Apply HMD orientation to camera rotation. POV.Rotation = FRotator(POV.Rotation.Quaternion() * CurHmdOrientation); }
void FSimpleHMD::ApplyHmdRotation(APlayerController* PC, FRotator& ViewRotation) { ViewRotation.Normalize(); GetCurrentPose(CurHmdOrientation); LastHmdOrientation = CurHmdOrientation; const FRotator DeltaRot = ViewRotation - PC->GetControlRotation(); DeltaControlRotation = (DeltaControlRotation + DeltaRot).GetNormalized(); // Pitch from other sources is never good, because there is an absolute up and down that must be respected to avoid motion sickness. // Same with roll. DeltaControlRotation.Pitch = 0; DeltaControlRotation.Roll = 0; DeltaControlOrientation = DeltaControlRotation.Quaternion(); ViewRotation = FRotator(DeltaControlOrientation * CurHmdOrientation); }
void THISCLASS::OnStep() { printf("ComponentEpuckAccess: Begin OnStep... \n"); // do one by one int founddev = 0; // Check e-puck device for(int i = 0; i < ACTIVE_ROBOTS; i++){ if (!mDevice[i]) { printf("E-puck device: %d not found.\n", i); // Get the device handle EpuckGetDevice(i); SetParticleID(i); } else { founddev++; printf("==== [%d] Begin step tasks =====\n",i); EpuckQueryResetPose(i); // Check a particle pose exists DataStructureParticles::tParticleVector *p = mCore->mDataStructureParticles.mParticles; if (!p) { printf("No e-puck poses found.\n"); return; } GetCurrentPose(i); EpuckSetTargetPose(i, 4450, 870, 0); EpuckGoToTargetPose(i); printf("==== [%d] End step tasks =====\n",i); } } // if found none then wait and return if(founddev == 0){ //Sleep(INITDEV_WAIT); return; } // Set the display // DisplayEditor de(&mDisplayOutput); // if (de.IsActive()) { // de.SetMainImage(mCore->mDataStructureImageBinary.mImage); // } //printf("ComponentEpuckAccess: End OnStep... \n"); }