ga1pi2ga Posted December 15, 2020 Share Posted December 15, 2020 has anyone figured out thumb stick turning in vr? ,i have tried it but keep on getting a error that i do not know how to fix (i am using VRplayer lua the only extra code is here:) --teleporting feedback if VR:GetControllerButtonDown(VR.Right,VR.AButton) then VR:TriggerHapticPulse(VR.Right,50) end --player turning right if VR:GetControllerAxis(VR.Right,VR.TouchpadAxis).x > 0.15 then VR:TriggerHapticPulse(VR.Right,20) player:turn(0,45,0) end --player turning left if VR:GetControllerAxis(VR.Right,VR.TouchpadAxis).x < -0.15 then VR:TriggerHapticPulse(VR.Left,20) player:turn(0,-45,0) end Quote Link to comment Share on other sites More sharing options...
Josh Posted December 16, 2020 Share Posted December 16, 2020 Well, it means the player variable is nil. What is it supposed to be? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ga1pi2ga Posted December 16, 2020 Author Share Posted December 16, 2020 i am trying to turn the player using Turn but i don't have any idea how to turn a model Quote Link to comment Share on other sites More sharing options...
Josh Posted December 16, 2020 Share Posted December 16, 2020 Well, if the entity is the one the script is attached to you would say this: self.entity:Turn(0,1,0) Or you need to make "player" equal to the entity you want to turn. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ga1pi2ga Posted December 16, 2020 Author Share Posted December 16, 2020 thank you that fixed it but apparently this is not the way to turn in vr (the camera and controllers are not turned with the player model) Quote Link to comment Share on other sites More sharing options...
Josh Posted December 16, 2020 Share Posted December 16, 2020 Ah Okay. Turning the world around the VR player is only supported if you opt into the beta branch on Steam. This command offsets the position: https://www.leadwerks.com/learn?page=API-Reference_Object_VR_SetOffset If you call VR:SetOffset(position, rotation) or VR:SetOffset(x,y,z,pitch,roll,yaw) then it will turn the world around the player. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ga1pi2ga Posted December 16, 2020 Author Share Posted December 16, 2020 okay now i just cannot teleport outside of a small area otherwise the rotation works fine function Script:UpdateWorld() VR:SetOffset(0,0,0,0,avr,0) --teleporting feedback if VR:GetControllerButtonDown(VR.Right,VR.AButton) then VR:TriggerHapticPulse(VR.Right,50) end --player turning right if VR:GetControllerAxis(VR.Right,VR.TouchpadAxis).x > 0.15 then VR:TriggerHapticPulse(VR.Right,20) avr=avr+5 end --player turning left if VR:GetControllerAxis(VR.Right,VR.TouchpadAxis).x < -0.15 then VR:TriggerHapticPulse(VR.Left,20) avr=avr-5 end Quote Link to comment Share on other sites More sharing options...
Josh Posted December 16, 2020 Share Posted December 16, 2020 The way you teleport is by setting the x, y, z values in the offset command. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted December 16, 2020 Share Posted December 16, 2020 If you are using the built-in teleport locomotion, let's see...this is at line 299 of VRPlayer.lua: --Update offset position local pos = VR:GetOffset() local d = self.targetoffset:DistanceToPoint(pos) local speed = 2.0 if speed>d then speed=d end pos = pos + (self.targetoffset - pos):Normalize() * speed VR:SetOffset(pos) So you would want to add the rotation to that call of the VR:SetOffset() command: VR:SetOffset(pos,rot) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ga1pi2ga Posted December 16, 2020 Author Share Posted December 16, 2020 how can i convert from (pitch,roll,yaw) to vec3 rotation? i have looked at rotation but am unsure about the last two arguments Vec3 Rotation(number pitch, number yaw,number roll, Mat4 src, Mat4 dst) Quote Link to comment Share on other sites More sharing options...
ga1pi2ga Posted December 16, 2020 Author Share Posted December 16, 2020 please ignore the previous post figured it out --Update offset position local pos = VR:GetOffset() local d = self.targetoffset:DistanceToPoint(pos) local speed = 2.0 if speed>d then speed=d end pos = pos + (self.targetoffset - pos):Normalize() * speed local arot = Vec3(0,avr,0) --avr is addon rotation VR:SetOffset(pos,arot) 1 Quote Link to comment Share on other sites More sharing options...
karmacomposer Posted April 12, 2021 Share Posted April 12, 2021 If I want to use smooth locomotion and not teleport, how would I call this upon joystick movement? I know it involves VR:SetOffset or VR:GetOffset. Further, I can enter the VR world, but teleport nor locomotion work at all. I can walk around the world physically. How do I activate teleport and locomotion with the joystick controllers? Mike Quote MSI Dominator Laptop - Core i7 - 8 cores / 3ghz / 32gb RAM / Nvidia 980 GTX with 16gb vram / SSD drives MSI Dominator Laptop - Core i7 - 8 cores / 3ghz / 32gb RAM / Nvidia 1060 GTX with 8gb vram / SSD drives Alienware Laptop - Core i7 - 8 cores / 3ghz / 32gb RAM / Nvidia 1070 Ti with 16gb vram / SSD drives My Patreon page: https://www.patreon.com/michaelfelkercomposer My music for sale: https://www.tgcstore.net/category/513?format=all&perpage=30&textures=undefined&price=all&order=default&artists[]=87213 Custom synths and sounds - http://www.supersynths.com 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.