Hi All,
I'm hoping to get a better understanding on how to adjust the camera position of the VR headset. For example, if I was looking to move the VR view up a set number of units I know if can use:
- getActiveCameraNode().getWorldTransform() – to get the camera position matrix/list with x,y,z being values 3, 7 and 11 in the list
- getActiveCameraNode().setTranslation(matrix[3],matrix[7],z+1000) – to modify the position of the camera node
However, in this process the VR view tends to rotate, with the amount of rotation depending on where the VR is looking (this is a bit hard to explain). I can mitigate this by using getWorldRotation() before performing the translation, and using setRotation() after the translation to put the camera back. Unfortunately doing this creates a few frames of the rotation changing and makes the action uncomfortable to look at.
I then started to look at setTranformMatrix(), but I clearly don’t understand how this function works. Using the code below, I get different matrices before and after the setTransformMatrix(), despite not doing anything to the matrix/list.
matrix = getActiveCameraNode().getWorldTransform()
print(matrix)
getActiveCameraNode().setTransformMatrix(matrix, false)
print(getActiveCameraNode().getWorldTransform())
On the surface setTransformMatrix() seems like what I would want as it (I think) it allows the setting of both translation and rotation at the same time.
Can anybody help clear up the best way to move the VR camera around without the rotation problem listed above?
Thanks!