0 votes

Hi, I am interested in translating the ARVRController nodes by an offset via gdscript, like teleporting these controller nodes to a specific location without changing the camera's position. Since ARVRContoller nodes' position is managed by the ARVRServer, I don't know whether there is an approach where I can access ARVRServer and apply the transformation there to update the ARVRController nodes' positions directly.

My initial thought was to only translate the children mesh instances to achieve the visual effect via
left_mesh.translate(offset); right_mesh.translate(offset);
However, it seemed that these offsets were scaled or multiplied by the mesh's parent's (i.e. controller nodes) transformation so what I can see is that the translated mesh's position moves a large extent (probably the offset is multiplied by the rotation matrix of mesh's parent) when I am trying to rotate the controller a little bit.

For example, without offset, the mesh's position and rotation is a 1-to-1 mapping to those of controller nodes. With such offset, the expected result is only the mesh being translated to (x, y,z) but the rotation is still a 1-to-1 mapping, however, the current result was when I rotating 30 degrees (either clockwise or counter-clockwise), the mesh's position was translated horizontally or vertically.

I also tried to translate the object locally, but it did not work well.
left_mesh.translate_object_local(offset); right_mesh.translate_object_local(offset);
Besides this approach, is there any other way that I can solve this question. Some math thoughts are also helpful.

Any help appreciated, thanks.

in Engine by (26 points)

1 Answer

0 votes

Well, to avoid the scale effect from the parent (basically through the matrix multiplication), I created ghost(dummy) objects and manipulate these objects directly instead of using parent-child relationship.

by (26 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.