Doogie Posted December 11, 2019 Share Posted December 11, 2019 Hi everyone. New to Leadwerks, what a fantastic tool! Question: has anyone developed a vr movement script that does not use teleporting? I have zero lua experience, trying to learn as I go. Thanks in advance for any assistance! Doogie Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 12, 2019 Share Posted December 12, 2019 Take a look at VRPlayer.lua under Scripts/Objects/Player. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Doogie Posted December 12, 2019 Author Share Posted December 12, 2019 Thanks, I've already been looking at it. It's a bit complex looking currently, definitely need to develop more experience in lua. I was just wondering if anyone else had addressed the issue. Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 13, 2019 Share Posted December 13, 2019 I've done some locomotion experiments in C++. Just set the VR tracking space to Seated and move the character controller with the analog sticks. Time is really tight during the week, but I can try to write you something in Lua quick on the weekend if you'd like. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Doogie Posted December 14, 2019 Author Share Posted December 14, 2019 On 12/12/2019 at 6:09 PM, reepblue said: I've done some locomotion experiments in C++. Just set the VR tracking space to Seated and move the character controller with the analog sticks. Time is really tight during the week, but I can try to write you something in Lua quick on the weekend if you'd like. @reepblue I don't want to impose, but if you do find the time, that would be amazing! Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 16, 2019 Share Posted December 16, 2019 TL;DR: You can do a locomotion VR Player, but you need the C++ libraries due to one member being exposed. I didn't write any lua code, the code below is all C++; which can be converted to the lua syntax easily. The good news is I've done exactly what you have in mind. The bad news is that It's not possible in Lua due to one member not being exposed which is: static Quat headsetrotation; You need that member to apply the character's controller's rotation based on where the player is looking in the real world. Other than that,the only other tricky part is updating the VR offset with the player's location. We have CenterTracking called when a button is pressed to correct the center as we use Seated VR for this implementation (Seems the A and B buttons with the Index don't work in 4.6) if (VR::GetControllerButtonHit(VR::Left, VR::TriggerButton)) { VR::CenterTracking(); } Vec3 playerpos = GetEntity()->GetPosition(); auto cameraposition = Vec3(playerpos.x, playerpos.y, playerpos.z); VR::SetOffset(cameraposition + Vec3(0, m_flEyeHeight, 0)); m_pCamera->SetPosition(VR::GetOffset()); Then you move the character controller with this: playerMovement.x = Math::Clamp(VR::GetControllerAxis(VR::Left, VR::TouchpadAxis).x, -1.0f, 1.0f) * m_flMoveSpeed; playerMovement.z = Math::Clamp(VR::GetControllerAxis(VR::Left, VR::TouchpadAxis).y, -1.0f, 1.0f) * m_flMoveSpeed; I only did this in 4.6. I'm tempted to try this with the 4.7 beta as Seated VR is said to be fixed (And hopefully buttons on the Index work). Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
_provector Posted May 7, 2020 Share Posted May 7, 2020 Hi Guys, If you are stuck I can share my implementation of free movement in VR I wrote in LUA (pm me). reepblue -> Sorry for a noob question, but Im still looking through forums and can't fiind an aswer: How can I use c++ in player scirpts? Engine only allows me to attach lua script to enity, I have the project opened in Visual Studio as well. I have seen some post about people setting up cpp project with loosing lua ability, its still very confusing for me. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
reepblue Posted May 7, 2020 Share Posted May 7, 2020 I plan to write something up to give you an idea how to attach actors using the editor. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
_provector Posted May 7, 2020 Share Posted May 7, 2020 4 hours ago, reepblue said: I plan to write something up to give you an idea how to attach actors using the editor. That would be awesome. Thank You! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.