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: 

Difference in VR API 2.0 tracking matrix

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
LeviathanLevi
369 Views, 2 Replies

Difference in VR API 2.0 tracking matrix

I have some old VRED scripts that used the VR API 1.0 to let you move a node around with the touchpad just on the X and Y axis. It looked kinda like this:

def translate(self, speed, dirVector):
        if self.allowMove:
            current = getTransformNodeTranslation(self.moveNode, True)
            dist = speed * self.MOVE_SPEED
            newX = current.x() - dirVector.x() * dist
            newY = current.y() - dirVector.y() * dist
            setTransformNodeTranslation(self.moveNode, newX, newY, current.z(), True)
 
def controllerMoved(self, controller):
    touch = controller.getTouchpadPosition()
    controller.getWorldMatrix()
    mover.translate(touch.y(), Vec3f(matrix[2], matrix[6], 0))
    mover.translate(-touch.x(), Vec3f(matrix[0], matrix[4], 0))

controller.connectSignal('controllerMoved', controls.controllerMoved, controller0)

 I'm re-writing this script with VR API 2.0 however instead of controller.getWorldMatrix() I use device.getTrackingMatrix(). I'm not sure what the difference between these two 4x4Matrices is and how it's changed with new version of VRED

    def touchpadMove(self, device):
        touch = device.getButtonState("Touchpad").getPosition()
        matrix = device.getTrackingMatrix() #V2.0
        mover.translate(-touch.y(), Vec3f(matrix[0,2], matrix[1,2], 0)) # matrix values not the same
        mover.translate(touch.x(), Vec3f(matrix[0,0], matrix[1,0], 0))

My current understanding is .getTrackingMatrix() is relative to the HMD but .getWorldMatrix() is tied to the world origin. Is there a way for me to get the controller matrix relative to the world? Any insights into how these two method calls are different would be much appreciated.  

 

Cheers!

2 REPLIES 2
Message 2 of 3

Hi,

this should give you the world transform of the device:

matrix = device.getNode().getWorldTransform()

 

Message 3 of 3

Thanks so much, that's exactly what I was looking for

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

Post to forums  

Autodesk Design & Make Report