Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel committed Feb 3, 2022
1 parent eb03409 commit a29fc71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/TrackingReferenceDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,24 @@ vr::DriverPose_t SlimeVRDriver::TrackingReferenceDevice::GetPose()
{
return last_pose_;
}

void SlimeVRDriver::TrackingReferenceDevice::PositionMessage(messages::Position &position)
{
// Setup pose for this frame
auto pose = this->last_pose_;
//send the new position and rotation from the pipe to the tracker object
if(position.has_x()) {
pose.vecPosition[0] = position.x();
pose.vecPosition[1] = position.y();
pose.vecPosition[2] = position.z();
}

pose.qRotation.w = position.qw();
pose.qRotation.x = position.qx();
pose.qRotation.y = position.qy();
pose.qRotation.z = position.qz();

// Post pose
GetDriver()->GetDriverHost()->TrackedDevicePoseUpdated(this->device_index_, pose, sizeof(vr::DriverPose_t));
this->last_pose_ = pose;
}
1 change: 1 addition & 0 deletions src/TrackingReferenceDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace SlimeVRDriver {
virtual void* GetComponent(const char* pchComponentNameAndVersion) override;
virtual void DebugRequest(const char* pchRequest, char* pchResponseBuffer, uint32_t unResponseBufferSize) override;
virtual vr::DriverPose_t GetPose() override;
virtual void PositionMessage(messages::Position &position) override;

private:
vr::TrackedDeviceIndex_t device_index_ = vr::k_unTrackedDeviceIndexInvalid;
Expand Down

0 comments on commit a29fc71

Please sign in to comment.