mordentral
(mordentral)
January 24, 2018, 12:59am
2026
spaceharry:
Hi ,
Here is a little present for the awesome VRExpansionPlugin.
I came across another problem where I wanted to use the VRLeverComponent for and I decided to work again on it to make it rotate smoothly over the flip point. It is in a state now that I thought the VRExpansion Plugin could also make use of it, so I took my freedom to send it to you.
Below you find attached a 4.18 version of the example project just like in the video. The code additions in VRLeverComponent should just work fine also in 4.19 from what I saw. I marked every code change necessary with the comment “spaceharry” in h. and cpp file. Feel free to also use the mesh from my video in your example project.
Basically the lever rotation limited to yaw and pitch now works like kind of telescope and it behaves almost like it when moved by motion controller.
As of now there are two variable exposed to blueprint to take ajustments on: FlipZone and LerpOutSpeed.
FlipZone defines a zone on a sphere near where the lever would flip around its roll axis or small location changes from the motion controller would cause swirling rotational motions. As of now inside zone the lever can only increase or decrease in pitch to avoid those problems. FlipZone value can be increased to further stabilize swirlmotion or decreased to allow more yaw rotation before locking in.
LerpOutSpeed is just for lerping back to “real” motion controller location after leaving the flipzone.
I didnt need to limit the rotations axis as of now, but I surely will take a look at it. Also currently lever doesnt return to its initial position. implementation is not perfect in any sense, but still I thought that someone could use a light projector on the stair platform.
I’ll look into it, there are obviously still some rotational accumulation issues with it and some drifting, but that is to be expected with what is basically a corrected lookat. It has a pretty nasty singularity where it flips continuously trying to account for the last position over and over (don’t let go of the lever like in the video, keep sweeping it around without letting go).
I wouldn’t be adding it to the XY one though like you did, I don’t want that mode to act in that manner, but it would be a good fit for XZ assuming the singularity and drift can be accounted for.