psmoveservice / psmove-ue4

Plugin for using PSMove as input into Unreal Engine 4. Currently obsolete. Please use PSMoveService.
GNU General Public License v2.0
59 stars 28 forks source link

Compiling for 4.11 #25

Closed ambershee closed 8 years ago

ambershee commented 8 years ago

Hello!

So as I mentioned before, this doesn't compile in 4.11 at present. I tried rolling back to 4.10, but it turns out HMD support is a bit broken in 4.10, so that's not a great option for me either - so fixing up the plugin for 4.11 it is.

There are two issues with the plugin in 4.11, the first is easy; an implementation needs to be provided for ETrackingStatus GPSMove::GetControllerTrackingStatus(const int32 ControllerIndex, const EControllerHand DeviceHand), which I have fudged.

The second problem is nasty and outside of my programming field of expertise as a designer - FPSMoveRawControllerData_Concurrent is throwing a C2280 because (I believe) a copy constructor is being generated for it by the compiler when it should not be, as the struct is considered a Plain Old Data structure. If anyone has the knowledge to fix it, I'd certainly appreciate the assist!

HipsterSloth commented 8 years ago

@ambershee Oh yeah I hit this issues myself. You can fix this by doing making the following edits in PSMoveTypes.h:

Basically none of those classes need to be exposed to Unreal since they are runtime only, non serialized and non networked.

As for the GetControllerTracking status thing I added the following method to FPSMoveInputManager:

ETrackingStatus FPSMoveInputManager::GetControllerTrackingStatus( const int32 ControllerIndex, const EControllerHand DeviceHand) const { bool RetVal = false; const FPSMoveDataContext *ControllerDataContextConst = PSMovePlugin->GetDataContextByPlayerHandConst(ControllerIndex, DeviceHand);

ETrackingStatus TrackingStatus = ETrackingStatus::NotTracked;

if (ControllerDataContextConst != nullptr && 
    ControllerDataContextConst->GetIsTracking())
{
    TrackingStatus= ETrackingStatus::Tracked;
}
return TrackingStatus;

}

And to FPSMoveDataContext I added:

bool GetIsTracking() const { return IsConnected() && RawControllerData.CanSee; }

I can make a pull request this weekend with the 4.11 fixes.

ambershee commented 8 years ago

This is fantastic - thank you so much Guido :)

plachenko commented 8 years ago

Hey!

Could you keep this issue open until a fix is merged? I've been having the same issue and had to roll back to 4.10.4 for it to work. @HipsterSloth I tried implementing the fixes you described but it still couldn't compile for me.