Jump to content

Recommended Posts

Posted

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

image.thumb.png.329b70b14665a6ed86d12c905d6ac04e.png

image.thumb.png.a9f39a7897a9c034678780d5d80a6162.png

Posted

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.

 

Let's build cool stuff and have fun. :)

Posted

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

 

Posted

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)

Let's build cool stuff and have fun. :)

Posted

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)

 

  • Like 1
  • 3 months later...
Posted

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

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&amp;perpage=30&amp;textures=undefined&amp;price=all&amp;order=default&amp;artists[]=87213

Custom synths and sounds - http://www.supersynths.com

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...