[SOLVED] vrCamera strange issue in script 2.0

Hi,
I am not 100% sure but I think something happened to the orientation/position of vrCamera in script 2.0

previous to script 2.0 i used the following to put vive controllers into a scene by putting the following into an update on a model

var gamepads = navigator.getGamepads();
this.gamepad = gamepads[this.gamepadnum]; //set to 0 or 1 depending on which htc vive controller you want
var pos = this.gamepad.pose.position;
this.entity.setPosition(pos[0],pos[1],pos[2]);

this worked fine pre 2.0 and the controllers would appear relative to the HMD position in the correct place in room space

however now the controllers appear in a totally different place to the camera. almost as if their positions were rotated. but since i am reading the positions directly from the gamepad api and not through playcanvas I can only assume that it’s actually the vrCamera which is somehow rotated.

not sure if I am making much sense :wink:

anyway it’s effectively stopping me from using scripts 2.0 to develop apps for the HTC vive.

looks like it not just the orientation that has been effected . it also appears that the position of the controllers is below the HMD as well.

created a simple example to demonstrate the issue

https://playcanvas.com/project/410598/overview/controller-20-test

Maybe you could debug the vr_camera? It’s a regular script.

You aren’t taking into account the sittingToStanding transform when you set the position of your controllers.

See how I’m doing it in the Orange Room demo: https://playcanvas.com/editor/code/384523/tracked-controller.js

Hi Dave,
I cannot get into either of those projects, the orange room link is coming up

403 forbidden and the other one 404 project not found

edit: i didn’t know about the sittingToStanding transform, it just worked straight of the bat in the pre 2.0 scripting system. Is it possible to get a small example in code on how to do it?

Ah, sorry. I’ve made that project public so you should be able to see it now.

thanks you, much appreciated, problem solved.