KozGit / DOOM-3-BFG-VR

Doom 3 BFG VR: Fully Possessed. Doom 3 BFG with native Oculus Rift/Touch or OpenVR support
GNU General Public License v3.0
370 stars 52 forks source link

add option to use real floor height #102

Closed CarlKenner closed 7 years ago

BernieBI commented 7 years ago

agree, it would be a nice function

CarlKenner commented 7 years ago

Fixed, but it's not quite right, and I can't work out why. The chaperone is slightly above the virtual floor.

KozGit commented 7 years ago

In idPlayer::GetViewPosVR, there is a 5 inch offset added to the view height. This was put in place because the armor/player body is so tall it blocks the view if it's not included when using the default view height. If you drop the view height in the menu by 5 inches ( from your real world view height ) , I bet the chaperone lines up perfectly.

1st easy fix is to add this offset to the value displayed in the viewheight menu ( display the effective value ) , that way it makes more sense.

Changing the view height when viewing the player body is an issue - the view origin can drop into the model and it looks terrible. I need to figure out the best way to scale the player model when the view height is changed. I can't just scale the model matrix, because that will break the joint calculations and collision + hit detection for the player ( warnings in the code not to do this. )

I'm thinking I may split the difference of the delta between the adjusted view height and the default view height, and try to apply it when the leg IK is computed. Kind of like when ducking the knees bend, but instead adjust the chest joint so the torso shrinks a little vertically, same with the hips.

I also think it might make sense to scale the view height when vr_scale is changed.

I would like the vr_useFloorHeight to default to 0 - when it's enabled, for me it totally breaks switching between standing and seated play, which I do frequently when developing. I think this is a fairly big change to the way position is calculated, and I think it should be an opt-in, esp. for established users. When I first started this, I actually specifically designed so the eyes were in the correct position, and not the floor. It's a great option, and one I should have put in ages ago, I just don't want to confuse existing players when the tracking behavior changes. ( The first time I played with this option, I didn't know you had added it, and thought I had messed up my rift tracking. Yes, I'm an idiot.)

CarlKenner commented 7 years ago

Sorry, I'll change the default back.

You are changing the lengths of the arms somehow. I don't know if you can do that to the torso or legs too. But for now our huge space marine just bends his legs to duck down when using the floor height, if you're not that tall. It doesn't break seating/standing play, unless your chair is low enough to count as crouching, in which case you can't jump. It works as intended... you are seated height in-game and the floor is in the right spot. Which personally I like when playing seated, but they can easily change it in the menu. It might break the motion-triggered crouch though. I forgot about that option, now that it's off by default. Dropping the view height in the menu should have no effect in floor height mode. I'll just subtract a constant 5".

KozGit commented 7 years ago

No need to apologize!

I already updated the default, and added code to switch the oculus tracking origin between seated and standing when the option is changed. ( Otherwise when it's enabled, the some of the tracked screens, like the legal splash and the loading screens, are too low.)

CarlKenner commented 7 years ago

That 5 inches is from some really old code that I added back in DK1 days, back when this was tmek's mod. DK1 didn't have any positional tracking, and I was crudely trying to make the head stay close to the neck in the player model, which was hard because the player model moved differently depending on what weapon I was using, so I was adjusting the head-neck model.

At some point we're going to have to review some of the really old code and see if it still makes sense. Because this function looks weird to me. We also need to document some of our tracking variables better so it's clear exactly what they're relative to.

CarlKenner commented 7 years ago

Fixed crouching when using floor height while seated. This mode is all fixed now.