playMaker

Author Topic: Use the right thumb-stick to rotate my first person character [SOLVED]  (Read 1761 times)

Adam Z

  • Full Member
  • ***
  • Posts: 207
Hey, so I'm create a VR player using the VR controllers. The left controller thumb-stick controls the movement which I have working fine. But I want to be able to use the right controllers thumb-stick to rotate the player on the Y axis. What Action(s) should I be using.

Thanks!
« Last Edit: April 13, 2020, 10:40:49 PM by Adam Z »

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 226
Re: Use the right thumb-stick to rotate my first person character
« Reply #1 on: April 13, 2020, 07:07:44 PM »
Hey Adam.

A basic implementation of this is actually pretty simple. You'll really only need three states and one custom action from the ecosystem "Rotate Around"

On the first state get the Vector2 axis from your controller thumb stick and store the x float using "Get Vector2 XY" and with two float compares get if this float is below -0.5 or above 0.5 and move to the left/right state accordingly.

Do the same on the left/right states only with one float compare and check for the opposite. So if you're in the left state check if the float is greater than -0.5 and the right would be less than 0.5.

In your left/right states use these settings on "Rotate Around"

GameObject = CameraRig.
Around GameObject = HMD.
Rotation Axis = y.
Angle = 45 or whatever you want.

This will give you a basic snap rotate depending on the position of the hmd in the playspace.

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Use the right thumb-stick to rotate my first person character
« Reply #2 on: April 13, 2020, 08:52:12 PM »
Thanks for this. What I'm actually trying to do is not a snap turn, but a fluid rotation based on the thumb-stick. I want the HMD rotation to be independent of movement.

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Use the right thumb-stick to rotate my first person character
« Reply #3 on: April 13, 2020, 10:40:29 PM »
Hey Adam...

Actually I took some of your suggestions and got it to work. There was too much motion sickness when rotating independently of the HMD, so I'll have to go with either a snapping system or teleportation.

Thanks for your hep though!