question

martin.j avatar image
1 Like"
martin.j asked Phil BoBo edited

Rotations in VR

I have been playing around with the VR Demo Model and expand on some of its functionalities for our own uses, but I have stumbled on to a problem. When picking up one of the operator figurines from the table the figuring will of course rotate around as I rotate my virtual hand to simulate that its actually being held. This however only works as long as the view z-rotation is 0 (standing right in from of the table). But with the ability to teleport around the likelihood that the rotation remains 0 is rather small. If the figurines are picked up while facing in any other direction that the initial 0 rotation. The behavior of the objects held becomes rather weird.

This is natural since the function to get the hand rotation 'stick(controllerNum, STICK_VR_HAND_WORLD_ROTATION)' returns the real world rotation of the and in the flexsim environment, but it does not take into account that we might be facing in another direction. I hav tried to solve this by projecting the rotation of the hand into the coordinate space of the view using Vec3.project() but it is still not enough. I'm missing some king of Quaternion transform functionality as I have seen it in various game development environments, but I'm affraid my math-skills aren't quite up to the task. Can anyone help here?

FlexSim 17.2.1
vrmathobject rotation
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

This is a bug in stick(controllerNum, STICK_VR_HAND_WORLD_ROTATION).

The purpose of that overload is to get the hand's rotations in FlexSim world coordinates, but it is actually returning the rotations in FlexSim view coordinates.

I have fixed those commands for 17.2.2 so that they return the correct rotations so that the figurines in this model are rotated correctly even if the view has been rotated.

The model's code doesn't need to updated; it is behaving how it is supposed to. That command is where the view rotation should be accounted for; you shouldn't need to do that matrix math manually.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

martin.j avatar image martin.j commented ·

Awsome, thanks Phil. Any idea when we can expect to see version 17.2.2? I'm itching to make my own stuff work in the VR. :D

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ martin.j commented ·

We should have a 17.2.2 release sometime in the next week or two.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.