cancel
Showing results for 
Search instead for 
Did you mean: 

Pawn Aim Offset, Head Rotation and HMD

OlivierJT
Explorer
Hello everyone.

So here's the deal,
I have a full custom pawn with a first person camera attached to a socket on the head bone.

As you know in UDK to have the pawn mesh animating to where you aim, there are animation frames inside (K_AnimHuman_AimOffset, and "Idle_Ready_Red_RU" for example)
These are 1 frame per look direction (8 total)
When you mouse aim, the animation (set in AnimTree) will blend to match your aim.

Before the Rift, I had this, perfectly working, so as they say a "True 1st person view"
-----
As you know also the rift camera take over everything so you can spin the HMD 360 all axis.
-----
Here is my problem :
The anim offset are still working, the HMD is attached to the Eye socket but looking around with the HMD doesn't propagate to the AimOffset Animation.
So I still can AimOffset with the mouse or the pad (I am using the pawn shadow to check that)

>I cannot make the aimOffset take the rift orientation
>I cannot match the mesh head with the rift.
(turning the rift doesn't turn the mesh head)

I am guessing I have to deal with the Oculus class "final native function UpdatePlayerViewPoint"
But I don't know how to do it and it's a native function so I don't know how to view it's code to learn from it.

Did anyone managed to do that ?
If yes I'll be happy to learn from you. ^_^
Merci
2 REPLIES 2

areisse
Honored Guest
UpdatePlayerViewPoint stores the exact quaternion read from the head tracker in PlayerController.CurHmdOrientation. You should be able use that and BaseHmdOrientation to update your bone's orientation.

PlayerController.BaseHmdOrientation has the quaternion when ApplyHmdRotation was last used to rotate the player (yaw only) according to the head tracker. PlayerController.BaseHmdRotation has the equivalent rotator.
You might need to make your own version of ApplyHmdRotation that's a better fit for your use, but still set the Controller.BaseHmdRotation to match the orientation of the camera.

While working on this, you might want to set:
[Engine.Oculus]
bUpdateOnRT=False

to disable the low-latency head tracking, since it makes the details simpler.

The next UDK update will provide easier direct access to the sensor readings from script.

OlivierJT
Explorer
Very cool ^_^
Thank you for your reply !

If I manage to do that, i will post it here as an example.