Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
stlava's avatar
stlava
Honored Guest
12 years ago

Pawn & HMD Rotation

I'm a little new to UDK and have been trying to figure out how things fit together. I'm having issues trying to figure out what to do to produce the following results:

Let's say a player's head is facing 90 degrees and his torso is facing 90 degrees as well. If a player turns their head 90 degrees (now at 180 degrees) and proceeds to turn their torso 90 degrees (now at 180 degrees) their head's view should not turn when the torso turns.

I need to essentially unlink the head and torso rotation movement so they can be independent of one another. I need to also be able to change the player's view to match their torso orientation on demand.

I'm sorry for not using the proper pawn and camera terminology. My project is real world position and rotation tracking (see viewtopic.php?f=29&t=46)

3 Replies

Replies have been turned off for this discussion
  • Hello Stlava,

    I was wondering, how did you set up your pawn ?
    Because I have the kind of behavior you are talking about working on my pawn.
    What kind of Anim Tree did you use ? your own or derived form one of udk ?

    Actually, the Oculus camera is taking over everything, so I can do 360 with the head... independently of the body...
    Problem is I cannot assign the oculus to the head bone, I can't aim the head, even with a
    I can't figure a way to have the hear orienting to the oculus direction.
    (using a SkelControlLookAt node)
    I would like to have the oculus rotating the body when I am beyond 90 also...
    Oculus is independent :(

    What i have with my pawn is the regular pawn behavior : I can use the pad to orient the oculus and when I am more than 90 the body turns.
    As my oculus is independent, i can reorient the body without the view moving.

    I wish there was a documentation, right now the "OCULUS_UnrealIntegration.pdf" is so light...

    Do you have your rift already ?
  • stlava's avatar
    stlava
    Honored Guest
    The oculus is unlinked from the pawn but when I try rotating the pawn the camera is rotated as well. I'm using the base UT implementation. Specifically I'm trying to rotate via Pawn.ClientSetRotation() but like I said it ends up rotating the pawn and camera simultaneously. How do you perform your rotation?
  • I am using an AnimTree based on the UT Cathode character.
    The skeleton has been made from sratch.
    The camera was attached using the add eyeSocket method
    So before Oculus i had true First Person and all was working well.

    I am using a gamepad so I rotate the pawn with
    Bindings=(Name="GBA_TurnLeft",Command="Axis aBaseX Speed=-200.0 AbsoluteAxis=100")
    Bindings=(Name="GBA_TurnRight",Command="Axis aBaseX Speed=+200.0 AbsoluteAxis=100")

    and using that I have 90 rot left and 90 rot right before the body turns.
    And the oculus is independent.

    "ends up rotating the pawn and camera simultaneously"

    I understand, it's not doing that on my side

    here is what I have in my PlayerController regarding the rotation :

    function UpdateRotation( float DeltaTime )
    {
    local Rotator DeltaRot, newRotation, ViewRotation;

    ViewRotation = Rotation;
    if (Pawn!=none)
    {
    Pawn.SetDesiredRotation(ViewRotation);
    }

    // Calculate Delta to be applied on ViewRotation
    DeltaRot.Yaw = PlayerInput.aTurn;
    DeltaRot.Pitch = PlayerInput.aLookUp;

    ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
    SetRotation(ViewRotation);

    NewRotation = ViewRotation;
    NewRotation.Roll = Rotation.Roll;

    if ( Pawn != None )
    Pawn.FaceRotation(NewRotation, deltatime);
    }


    And in my Pawn :
    /*
    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;
    }


    Kinda broken because it doesn't care about the eyesocket rotation anymore,
    Ouculus in on top :(

    I hope it helps
    (I have been learning Unreal script for like 2 month, so I excuse me if I am not clear in my explanation as a coder should be, I am not a coder ^_^)