UDKOSC and Oculus Rift

From CCRMA Wiki
Revision as of 11:35, 6 June 2013 by Rob (Talk | contribs) (Created page with ' Head bone HMD tracking example from https://developer.oculusvr.com/forums/viewtopic.php?f=44&t=936 /* GetViewRotation always match the camera to the rotation of the eye sock…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Head bone HMD tracking example from https://developer.oculusvr.com/forums/viewtopic.php?f=44&t=936

/* 
GetViewRotation
always match the camera to the rotation of the eye socket
*/ 
simulated event rotator GetViewRotation()
{
    local vector out_Loc;
    local rotator out_Rot;

    if (EyeSocket == )
        return Super.GetViewRotation();

    Mesh.GetSocketWorldLocationAndRotation(EyeSocket, out_Loc, out_Rot);

    return out_Rot;
} 

//function to aim the head where the player looks
exec function LookAt(int p, int y, int r)
{ 
local SkelControlSingleBone HeadControl;
local Rotator APlace;

APlace.Pitch = p;
APlace.Yaw = y;
APlace.Roll = r;

HeadControl = SkelControlSingleBone(Mesh.FindSkelControl('HeadControl'));
HeadControl.bApplyRotation = true;
HeadControl.SetSkelControlStrength(1.0, 0.5);
HeadControl.BlendInTime = 5.0;
HeadControl.bAddRotation = true;
HeadControl.BoneRotation = APlace;
}