[HTC Vive] Set Camera Position/Rotation

Hi everybody,

i am working for my thesis with the unreal engine and the htc vive. The main subject is to reduce cybersickness by head movement prediction.

Therefor i need to set the position and rotation of the camera.
(is this even possible? I mean if its possible i could set my view to the sky, but in reality i am looking forward → i need to look at the ground in reality to look straight in VR).
But thats exactly what i need.

I can read out position and rotation of my camera, and now i need to create a function that uses this values and calculates that next predicted position of my camera (for the next 5ms or something) AND sets the camera to this position.

I stuck with this problem for a while, and read a lot of threads and articles but have no ideas yet.
Maybe you can help me :slight_smile:

Greetings Aiko

I too need to predict camera rotation. No idea where to start - did you make any progress on this? I can predict character movement, but I want to predict head rotation (camera rotation ), too.

Hey rich2020,
at the moment i am working with the oculus rift. In the Oculus Library you can find the Blueprint function “Set Base Rotation and Base Offset in Meters”. This was the only possible way to set rotation of my HMD i found yet.

I’m interested in your way and function for prediction and would by happy if you could share some informations :slight_smile:

Hey,

To predict user movement, I use the previous position to predict the next. Essentially, I use:

next_position = velocity * deltaTime + previous_position 

Note that previous_position is a Vector 3 (x, y, z) and you must predict x, y and z independently (use the formula to predict x, then to predict y and then z). DeltaTime is the deltaTime from the update function.

I have managed to get rotation to work, too. I used the same formula just described, but I set velocity to the base turn rate (of the camera. Default is 45, I believe).

It looks as though it works well, but I have yet to test it in-game.

Hey, thanks for the reply :slight_smile:

i was “debugging” for the right implementation and tried a lot of ways. My thoughts were like: “i get point x and after 1 second i am at point y, so after 2 seconds if my predictions is one second into the future, i must be at point z, where z has the same distance to y, like y has to x”
but this way of thinking does not consider velocity

how would you use your way for saying “predict 5 miliseconds into future” and did you managed to set the rotation of the htc vive?

I am not doing this for a HMD - I am working on user movement and rotation prediction in a virtual world.

To predict further into the future, you could chain your predictions.

What I mean is, use the previous position to predict the next. Then use the predicted position to predict the next position and keep going until your deltaTimes sum to 5ms.

DeltaTime is the difference in time between the previous ‘tick’ and the current ‘tick’. You want to know when 5ms of time has elapsed, so just add your deltas.

Something like (Psudo code!):

list_of_poistion_predictions
dt
while dt <= 5ms
    dt += deltaTime //add previous delta time to current delta time
    index = length(list_of_poistion_predictions) - 1 //previous prediction
    //predict next position based on previous prediction
    predicted_position = previous_velocity * previous_deltaTime + list_of_poistion_predictions[index]
end while

Hope this helps!

okay, thanks a lot :slight_smile:

i’ll give this a try!