question

Jouky D avatar image
0 Likes"
Jouky D asked Phil BoBo edited

Location of the VR headset

I’m trying to set an object’s rotation (truck in the model attached) according to the VR headset current rotation angle and I haven’t been able to figure out how the rotation of the VR headset Works (the code to do so is in the User Event - ChangeVRRotation). I have printed the rotation angles obtained using the command stick(-1,STICK_VR_HAND_ROTATION) and I’ve noticed that some anomaly seems to be happening when reaching 78º and -88º approximately on the Z-axis rotation (a data sheet with the angles obtained from doing two full turns is attached too). How do the angles from the command stick(-1,STICK_VR_HAND_ROTATION) work?

VR_ObjectRotation_v2.fsm

ObjectRotationData.xlsx

FlexSim 23.0.1
virtual realityoculus riftheadsetset 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
0 Likes"
Phil BoBo answered Phil BoBo edited

STICK_VR_HAND_ROTATION returns the rotation in VR coordinate space (the raw values returned from the headset). If you want the rotation in FlexSim's coordinate space, use STICK_VR_HAND_WORLD_ROTATION, which will convert those values into the coordinate space used by objects in FlexSim.

https://docs.flexsim.com/en/23.0/Reference/CodingInFlexSim/CommandReference/Commands.html#stick

Also, rotations in FlexSim are expressed as Euler Angles, so the "anomaly" you are experiencing is probably because you are only looking at one angle instead of all three. You can get to the same ultimate rotation using different Euler Angles, so you can't just rely on one at a time, you have to account for all three.

5 |100000

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