cancel
Showing results for 
Search instead for 
Did you mean: 

Unity 5.1 FPS Controller Question

jmorris142
Explorer
I have the new VR Supported Mode working now and removed all OVR Prefabs in place of Unity FPS controller, but one strange thing I just noticed.

The OVR FPS controller would use your head forward facing position when you walk or "Sprint" forward so you were moving towards where you were looking. Felt great and correct,

The standard unity FPS controller walks or Sprints but doesn't seem to update to your forward looking position as well, the result is looking forward but moving sideways a lot of the time.

It took me a while to figure out why I was all of a sudden getting major motion sickness feelings on my scenes that felt fine before.

Is there a checkbox somewhere I could use to correct this or am I missing something somewhere?. Thanks

I can provide links to two scenes, one built in 5.0.2 and one in 5.1 if that is helpful.
19 REPLIES 19

cybereality
Grand Champion
Yes, I noticed this as well. I think the new way actually makes more sense (like turning your head versus turning your body) but it does mean you sometimes end up in a weird off-center angle. Let me see if there is a way to change this.

jmorris142
Explorer
Thank you for looking into this. It totally makes more sense but somehow it doesn't "feel" right. After a few more hours of experimenting, I think it's also that you can never move your mouse or controller as accurately of carefully as you can move your head, so things also feel way smoother with the previous version. Maybe the unity controller just needs the addition of that check box to use head movement, so anyone could choose to go either way.

jamiecurrie
Honored Guest
I found a quick fix for this, in FirstPersonContoller.cs.

Change this line: (line 100)
 Vector3 desiredMove = transform.forward * m_Input.y + transform.right * m_Input.x;

To this:
 Vector3 desiredMove = m_Camera.transform.forward * m_Input.y + m_Camera.transform.right * m_Input.x;

Its kind of hacky but it works for simple control 🙂

xhonzi
Honored Guest
Moving your feet with your head is gross.

BigB
Honored Guest
I have the same problem.
I think what the OP says, is that the way to move around our character, should be like in the Oculus demo (Oculus World Demo), we move our head and the direction is updated to face where we are looking at.
At the moment, we look somewhere and when we walk forward we go to a totally different direction, and this makes everything ackward.
The only situation I think this should not behave like this, is when we are in the control of a car, we don't want to turn the car with our head, but maybe a checkbox with an option or something ?

weasel47
Heroic Explorer
In real life you generally walk in the direction your body is facing, not the direction your head is facing...

BigB
Honored Guest
That's in real life, we are are doing games, not simulating real life.

jmorris142
Explorer
jamiecurrie, that works perfectly thank you! just what I was after.

BigB, exactly, well said:)

jmorris142
Explorer
jamiecurrie, been using your fix a lot now, it's great!

Now I have a more complex issue, that I am not sure if it is a unity thing, a physics engine thing or an oculus thing, but I am sure someone here can figure it out:)

My game relies on shooting projectiles based off your head position, since you shoot from cannons on your helmet.

I spawn a projectile prefab with a impuse force on a set axis at a set speed from a spawn point game object attached to my helmet that is also parented to the FPS camera etc. Everything moves perfectly with the head.

The change to the FPS controller to use your head movement to also change your walking movement direction is perfect, however my next issue is that projectiles spawned from the helmet move only in the direction that the mouse or controller was last pointing and do not seem to be using the rotation of the head even though they are parented and physical moving in 3D space to the correct rotation to spawn from. I hope this make some sense, I am no engineer, so I am sure there is a simple explanation or fix for this.