Plugin

is UScript (UDK) I’ve yet to update it but the principle is the same:


 local float xOffset, yOffset;
    
    //Offsets, take the average Z and X position to set the base offset
    HydraBaseHeightinCM = -1 * (RazerInput.LeftHandPosition.Z + RazerInput.RightHandPosition.Z)/2;
    xOffset = -1 * (RazerInput.LeftHandPosition.X + RazerInput.RightHandPosition.X)/2;
    yOffset = -1 * (RazerInput.LeftHandPosition.Y + RazerInput.RightHandPosition.Y)/2;
    
    //Player Vector offset (center point)
    HydraPlayerOffset.X = xOffset;
    HydraPlayerOffset.Y = yOffset;
    HydraPlayerOffset.Z = HydraBaseHeightinCM + 40;
    
    //Wing Separation
    ArmLength = VSize(RazerInput.LeftHandPosition-RazerInput.RightHandPosition);
    ArmLengthFactor = 161/ArmLength;

The function is called when a player is in a T-pose, which captures the base offset, the player center point (shoulders for flight), and the player wing separation.