using mouse controls to navigate

Is it there a script or settings that I can used to be able to navigate around the game environment using mouse controls? Id like to left click and drag to walk around, right click and drag to elevate and use the middle button to look around.

in scene view or game?

1 Answer

1

you can use the basic movement scripts and change their virtual inputs on Edit>Project Settings> Input a tab will ope on the right side with the presetted inputs, it`s easy to figure from there.

http://unity3d.com/support/documentation/ScriptReference/Input.html

something like this:

private var moveDirection = Vector3.zero;

private var grounded : boolean = false;

var turnSpeed = 2.0;

private var moveRotation = Vector3.zero;

function Update() {

if (Input.GetButtonDown("Fire1") {

// left mouse is clicked, so recalculate movedirection directly from axes

  moveDirection = new Vector3(0, 0, Input.GetAxis("Mouse Y"));

  moveDirection = transform.TransformDirection(moveDirection);
  moveDirection *= speed;
  moveRotation = new Vector3(0,Input.GetAxis("Mouse X"),0);

  transform.Rotate (moveRotation* turnSpeed);

} }

Place it on the highest gameobject in the hierarchy of your character. a good place to start is http://unity3d.com/support/resources/ there are lots of useful stuff and examples for common and some obscure algorhytms