Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Modify VR HMD/Camera Postitions with Python

0 REPLIES 0
Reply
Message 1 of 1
daniel.jeffery
441 Views, 0 Replies

How to Modify VR HMD/Camera Postitions with Python

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!

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report