jrbudda / minecrift

VR mod for Minecraft. For Minecraft version 1.7.10
http://www.vivecraft.org
Other
323 stars 32 forks source link

Request - camera rotation with controller #62

Closed d00nicus closed 8 years ago

d00nicus commented 8 years ago

Would it be possible to add a way to rotate the camera left and right using the controller through a button mapping?

I can rotate the view fine when standing obviously, but I'm partially disabled and therefore many days am limited to only being able to use the Vive from my bed, which limits my ability to turn around other than stretching my neck as far as it will go and teleporting backwards. In 2D I'd use mouselook, but there isn't really an equivalent here.

Thanks for considering this, I appreciate you taking the time to read it :)

jrbudda commented 8 years ago

When they started converting the mod to the Vive they pretty much took out all the controller support in favor of roomscale. The roomscale movement and such is heavily tied in the game doesn't have any controller code left.

At some point, especially when Oculus Touch comes out, I may try and get a more unified 'OpenVR' version together with optional roomscale/controller/hydra/mouse or whatever, but I can say for certain that's not going to happen soon, the current focus is roomscale for this version of the mod.

The other possibility is the original MinecRift guys had interest at one point of adding OpenVR to theirs, which is a seated experience and has the mouse/controller look you're after. I don't know if they're made any progress on it.

What you need is a motorized spinny bed!

d00nicus commented 8 years ago

I was afraid something like that might have happened :/ I'm a C coder by trade, so I haven't really peeked into the source for any of this because Java, but if there's no mouse-look etc type functionality, I'm wondering how hard it might be to bash together a reasonably small Forge mod that adds a custom keybind to just forcibly rotate the player at 45 degree increments or something - not perfect, but together with the existing headtracking I could probably navigate reasonably well.

I know I'm a very-very edge case usage, so in the worst case if there's absolutely no possibility of you being able to bodge anything together, I may take a shot at hacking something together myself (albeit following a bare bones crash course Java study)

jrbudda commented 8 years ago

The thing is the the OpenGL perspective is set directly from the HMD pose information, there's no clean 'intermediate' step where you could rotate the 'camera' 45 degrees. You'd have to dig in the quaternion math that generates the model view and hack it to add your offset. I dunno about you but quaternions make my head hurt.

d00nicus commented 8 years ago

Damn, this problem has moved way out of my skill range it seems then :(

I hadn't realised the camera was actually locked directly to the pose like that. I'll make do for now then - the other stuff you've added is way too good not to play this version, I may exhaust myself, but I haven't had this much fun playing minecraft in years, so thank you for that!

If/when a solution does ever happen though, let me know - I'll quite happily hang at minimum £150 bounty on this problem, it's easily worth at least that much to me

jrbudda commented 8 years ago

So I made some preliminary tests and at least understand the problem better now, and you definitely cant just rotate the camera around to simulate turning your head, because then the controllers are behind you, could potentially fix that but all 3 devices are tracked from the center of the 'room' so would have to translate back, rotate, translate out. Even then your head translation then becomes backwards.

What I have to do, I think, is rotate the 'room' with respect to the game world. There was no code written to do that at all, the assumption was that the room would be aligned a certain way with the world. I have no idea how much of the roomscale stuff relies on that assumption about the coordinate systems being the same.

This would come with the issue that you teleport around in a circle if you were sitting offset from the center of your room.

I'll keep thinking about it.

d00nicus commented 8 years ago

Thank you, I really can't express how much it means to me that you're looking into this for me.

Assuming I reconfigure into standing mode, it shouldn't be too much of an issue to keep myself centered if I don't move from the spot I run setup - that's a small price to pay if the rotation actually works

jrbudda commented 8 years ago

Hoping to have this be possible within the next week. Lot of code has to be re-done but's necessary for the future maintainability of the mod.

jrbudda commented 8 years ago

If you're still interested give this a try. Still very much in beta so expect bugs. You can rotate around in 45 degree increments using the left or right arrow keys on the keyboard or you can bind the 'Rotate Left' and 'Rotate Right' commands to a Vive button. Let me know what you think.

vivecraft-1.7.10-Vivecraft-jrbudda21beta-installer.zip

d00nicus commented 8 years ago

That's fantastic, I'll give it a go this evening after I finish working and report back :)

d00nicus commented 8 years ago

Wow. That was amazing - I think it glitched a couple of times regarding turn direction, but that may have been touchpad related. Other than that though, it was fantastic - and considering it's only a beta was incredibly playable and doesn't seem to conflict with the standard tracking when I am standing up.

Edit: Ok, one bug I've just hit. Sometimes on entering a world, I fall to bedrock and die.

halotosis commented 8 years ago

Dude, I haven't had a chance to try this yet, but first off, thanks so much for the awesome vive support. I as well am partially disabled (to the degree I spend the majority of my time in a wheelchair). The ability to shift the playbox and rotate it by teleporting in place solves sooo many challenges. Will try later tonight. You rock.

halotosis commented 8 years ago

OK, so I got a few minutes and tried this out... excellent work! I found two bugs.

One, my arms only half rendered the first time. They were invisible the if I turned them over. No big deal, but looks like it has something to do with rendering the player skin? Cool. Second time I fired it up, they fully rendered.

Two and this is the one you probably want to look into, this messes up free move. You probably need to compensate for the rotation in the free move functions.

Otherwise, sooo useful. I might actually be able to play for more than a minutes without constant fiddling with my chair or standing uncomfortably. Thank you.

jrbudda commented 8 years ago

Are you using controller or HMD-directed free move? I would have sworn free move was working in the build I uploaded before.

Try this one.

vivecraft-1.7.10-Vivecraft-jrbudda21-installer.exe.zip

Spawning underground is a known problem I'm working on.

halotosis commented 8 years ago

No good. This build has something really wrong with it, flickering... everything. I switched back the the previous to confirm, worked fine... switched back... flickering objects everywhere.

As for the free move, I find myself switching back and forth between movement modes regularly... but in this case, I stood in place, pointed my left arm forward, rotated, pulled the trigger, rotated, pulled the trigger... etc. Each time I went in a different direction (as in, not always my forward). The free move seems relative to the world, not the orientation of the playbox.

jrbudda commented 8 years ago

OK, sorry for the bugs. Separating the coordinate systems has been a massive undertaking and every little bit of geometry in the game had to change. Not sure what's up with the flickering works OK in my test environment.

halotosis commented 8 years ago

No worries about the flickering, I was able to tolerate it long enough to try the changes. I'm a software engineer by trade, buggy things is what I do for a living.

halotosis commented 8 years ago

So I played with is some more on the non-flickery build. Interesting result, free move seems to work fine at 0 and 180 degrees, but is off in between.

jrbudda commented 8 years ago

Yup I think I found the problem., havent fixed flickering tho, that's weird as hell it's only in one eye and only every couple of frames. Also you should totally go into VR Settings > Stereo Renderer and play with the World Scale.

jrbudda commented 8 years ago

Okay I think I got it squared. More bugs plz, they are delicious.

vivecraft-1.7.10-Vivecraft-jrbudda21-beta2-installer.zip

halotosis commented 8 years ago

Oh, I did play with world scale... one of the better additions, that will also help a TON for those of us who are nominally about three and half feet tall (in a wheelchair). I was making steam change the floor, but that made it feel unsettling seeing the play space on the floor below where it really is (even more important in a wheelchair to know your bounds).

jrbudda commented 8 years ago

That's awesome, I had intended it for a purely fun cosmetic thing but if helps you play that's great.

jrbudda commented 8 years ago

Do I need to add more granularity to the world scaling?

halotosis commented 8 years ago

Wow! That works soooo well! I can move around effortlessly. I haven't felt so, well, free to move around in a full scale VR game yet. I have done it standing up and moving around and it's amazing, but have done more in my chair.

I have considered contacting Valve and asking them about incorporating the ability to virtually rotate and this proves how effective it could be. If it was simply part of the control system, developers wouldn't even have to concern themselves, just pay attention to the normal tracking.

As per the world scale. I had set it to 2.00 and that made the world feel the right height to me. I just tried jacking it all the way up... so cool, I feel like the world is a giant lego set (I didn't try manipulating things). I would definitely give more options between 1.00 and 2.00 and probably even add 3.5. It's generally good that it's logarithmic though. I might even consider allowing the user to go bigger... or drastically smaller.

halotosis commented 8 years ago

Okay, now I scaled it down to .1 and it's equally amazing. I want to make VR doom out of a minecraft blocks. Only comment, movement speed, not sure if that's already adjustable somehow and while is fun blazing around a giant brick landscape, might make people nauseous, I don't personally seem too susceptible. I also didn't mention, but I'm not getting the flicking with this build.

BTW, it's my birthday and you made my day. Seriously.

jrbudda commented 8 years ago

There is a movement speed multipler in the locomotion options. It's not tied to world scale, I was worred it would be too fast for the game to keep up.

halotosis commented 8 years ago

Nice, I like that it's not tied to world scale. Some people might like to go faster when scaled up to 20. This will be a lot of fun in creative mode. Or playing in a survival world full of giant monsters.

halotosis commented 8 years ago

So, before I go to bed, these updates made it remarkably fun. I can easily move around the world and turn and if I want to explore at roomscale (I have 3'x2' space setup), I can put down the controllers and use my hands to move around the local area. Absolutely the best of both worlds.

I did encounter a bug, opening chests and other inventories seems glitched, the panel only displays for a fraction of a second when closing the inventory. I was in the nether, don't know if this is an issue, in previous builds, torches had problems and now that's fixed.

And also manipulating the world doesn't work well at large scales, I could delete blocks, but not place them. I could place them only at my feet. And the weird thing is, if I removed a block, I could replace it, but it would always reappear as what is was before removing it.

In any case, I think I owe you a beer.

jrbudda commented 8 years ago

The world scaling is very much a cosmetic thing at this point. There's all sorts of issues with block reach and chunk loading to overcome to make it a real gameplay thing. And it wouldnt be multiplayer compatible anyway. I still to to look at the chest GUI, figured that still had issues.

jrbudda commented 8 years ago

This is done, gonna close this but feel free to add feedback here.