Open vittorioromeo opened 9 months ago
Just tested this out, the portaling feels a lot better to me! Nice work.
FYI, the pitch angle was slerping properly but the roll angle was still snapping instantly upright (since QAngle::VectorAngles
was always giving finalAngles
a roll value of 0). There's another QAngle::VectorAngles
function that takes a forward vector and an up vector which will give the needed roll value.
Another thing to note is that slerping the roll value when it's at 180 is undefined (or in my case when the upSrc vector was opposite the upTarget vector). If you put two portals on the ground and go into one, it works, but the view stays upside down longer than it should. Clamping m_RotationOffset.z
between -179 and 179 seems to fix it.
I'm also getting a bug where if a portal is on a 45 degree surface and another portal is on the floor, jumping into the floor portal tends to rotate my yaw by 180 when I exit. Not sure what's causing that one.
So I fixed the 180 degree yaw issue by setting finalAngles.y = lastYaw
, but then when I jumped into the floor portal, coming out of the 45 degree portal caused the view to do a needless 180 degree roll. I figured out that if you come out of the 45 degree portal with a yaw greater than 90 (or less than -90), then that yaw value gets transformed to a negative roll value in QAngle::VectorAngles
after slerping is done.
Instead of slerping the forward and up vectors, it seems like lerping m_RotationOffset
's pitch, yaw, and roll individually to targetRotation
's values fixes these issues.
@sd805: nice! Those sound like good improvements. Do you have a full diff you can apply on top of this PR, or as GitHub review suggestions?
Thank you for your hard work on this! I've been waiting for this fix since the VR mod release. Could someone please help me to make it work?
Here's what I did:
git clone --recurse-submodules https://github.com/Gistix/portal2vr.git
git fetch origin pull/103/head
git checkout -b pullrequest FETCH_HEAD
vr.cpp
with this onel4d2vr.vcxproj
l4d2vr.sln
in VS2022, changed x64 to x86 and built it.d3d9.dll
from the Release folder to the Portal 2\bin
folder.Portal 2\VR\config.txt
file:
PortallingDetectionDistanceThreshold=35
ApplyPitchAndRollPortalRotationOffset=true
CameraUprightRecoverySpeed=0.2
The errors disappeared, but the camera transition is still instant, so I can't play the game.
I also tried CameraUprightRecoverySpeed
0.0001, 0.001 and 0.01, nothing changed.So I fixed the 180 degree yaw issue by setting
finalAngles.y = lastYaw
, but then when I jumped into the floor portal, coming out of the 45 degree portal caused the view to do a needless 180 degree roll. I figured out that if you come out of the 45 degree portal with a yaw greater than 90 (or less than -90), then that yaw value gets transformed to a negative roll value inQAngle::VectorAngles
after slerping is done.Instead of slerping the forward and up vectors, it seems like lerping
m_RotationOffset
's pitch, yaw, and roll individually totargetRotation
's values fixes these issues.
Can you please help me to make this fix work? Or just share the compiled d3d9.dll
? Above I posted what I tried.
It seems like the mod creator doesn't care about merging this branch, but lack of this feature stops me and a many other guys issues/107, issues/55 from starting to play.
Thank you!
@ORanGeOfficial Sure. Here's my d3d9.dll and config.txt
@ORanGeOfficial Sure. Here's my d3d9.dll and config.txt
Thank you so much! Now everything works perfectly!
Adds a new optional feature: the camera's pitch/roll can now follow the orientation of the exit portal when portalling. It looks like this:
https://i.imgur.com/CCBm79q.mp4
The feature is customizable through three config variables: