Locking movement to one axis only (3D game)

Hi guys, quick question here.

I’ve looked around and tried different methods for this, but none seem to work. So here’s the deal. I’m making a game where you can only move back and forward, no side movement and no turning around with the mouse, I’d like the movement independent from looking around. I can’t think of any examples, so it’s harder to explain.

It’s a fencing game, so imagine fencing. Moving forward and back on a strip, and for obvious reasons I don’t want the mouse to do a 360 turn, only a limited turn. (So you don’t loose eye contact with your opponent)

I hope someone can help.

Thanks,

Jamie!

Hey, I had the same problem, but I am doing a 2D game using the first person controller (I am a noob here) and I tried the same thing you did, then, after, I set sideways movement to 0.01. It worked, kind of, it is REALLY slow, and depending on how smart your AI is (or if it is online) that should be enough, but I too am looking for a way to disable it completely.