How to fly with First Person Controller?

For an industrial project I need to have a ‘flying’ First Person Controller. Do anyone have any idea how to implement such a movement? It should have no limits or gravitation bounds.

Many thanks in advance.

Hi, welcome to the forum!

The usual first person controller will probably not be what you want because it is designed for tracking the ground and bumping off obstacles. The way you approach this task depends on exactly what type of control and visual effect you are looking for. If this is basically for positioning a camera to get different views of an industrial environment, then you will probably want a camera that hovers at an adjustable height, but can be moved and turned relative to the floor and also elevated. If the flight dynamic is significant, you might want something more like the view from an aircraft cockpit.

Perhaps you can fill in a few more details about what you need the controller to do and what sort of precision and/or physical realism you need for positioning the view.

andeeee wrote:
“…If this is basically for positioning a camera to get different views of an industrial environment, then you will probably want a camera that hovers at an adjustable height, but can be moved and turned relative to the floor and also elevated…”

This is exactly what I like to have. Only to have a more-than-360°-view of a whole Steelplant.

A free-roaming-user-controlled camera.

Hi,

I just modified the FPSWalker script.

I created a new script call FPSFlyer with this:

var speed = 6.0;
private var moveDirection = Vector3.zero;


function FixedUpdate() {

		moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("UpDown"), Input.GetAxis("Vertical"));
		moveDirection = transform.TransformDirection(moveDirection);
		moveDirection *= speed;
		
		var controller : CharacterController = GetComponent(CharacterController);
		var flags = controller.Move(moveDirection * Time.deltaTime);
				
	}

@script RequireComponent(CharacterController)

Use that on the FPSWalker prefab that comes with the Standard Package. Then:

  1. In the editor go to ‘Edit’ >> ‘Input’ and add a new ‘Axes’.
  2. Call it ‘UpDown’.
  3. Bind whatever key you want to use.
  4. Give the rest of it the same values as is found for the first ‘Horizontal’ entry.

Works for me…

1 Like

Ok, I got it.

Thank you very much!

yep, exactly what I needed, Thanks.

Check out the FPSWalkerEnhanced in the Unity Wiki:
http://www.unifycommunity.com/wiki/index.php?title=FPSWalkerEnhanced

Hi, Mike Basitan

I’m a student working on a thesis project where I have to create a diver exploring a wreck in water. I don’t have any idea how to fly the first person controller (representing the diver). I would really appreciate if you can explain to me step by step the process of how to do it or else if its possible video record the process.
I will certainly acknowledge you in my thesis for helping me. my email is spanni87@gmail.com. thanks in advance.

Best regards
Daniel

Look at the scripts and tweak or remove the gravity variables. At least that’s a start.

Thanks Mike, your script worked for me.

Great! Thanks Mike!