# Help ME Finish this script, it is EASY for u, but HARD for me.

Hi,I am an artiss, and i know nothing about Js script, I have spended four days to make my character move like this: In play mode, when I press and drag left mouse button, my character will rotate, and when I press and drag the right button, my character will move in XY plane, when I scroll wheel, it will zoom in and out. It pretty much like the navigation in Unity, just without the ALT button, I have search the whole internet to finish the script, but for now, I just make my characte rotate and zoom perfectly, but the pan move is not so good, when I right click and drag, my character can move, but when I rotate it, it will come back to the original point, how to I fix that, I have no idiea. MY HEAD ARE EXPLODING. Please help me! Here is the script so far. Thank u so much!!!

var target : Transform;
var distance = 10.0;

var xSpeed = 250.0;
var ySpeed = 120.0;

var yMinLimit = -20;
var yMaxLimit = 80;

var distanceMin = 3;
var distanceMax = 15;

var moveSpeed : float = 1;

private var x = 0.0;
private var y = 0.0;

function Start () {
var angles = transform.eulerAngles;
x = angles.y;
y = angles.x;

// Make the rigid body not change rotation
if (rigidbody)
rigidbody.freezeRotation = true;
}

function LateUpdate () {
if (target (Input.GetMouseButton(0) || Input.GetAxis(“Mouse ScrollWheel”)) ) {
x += Input.GetAxis(“Mouse X”) * xSpeed * 0.02;
y -= Input.GetAxis(“Mouse Y”) * ySpeed * 0.02;

y = ClampAngle(y, yMinLimit, yMaxLimit);

var rotation = Quaternion.Euler(y, x, 0);

distance = Mathf.Clamp(distance - Input.GetAxis(“Mouse ScrollWheel”)*5, distanceMin, distanceMax);

var hit : RaycastHit;
if (Physics.Linecast (target.position, transform.position, hit)) {
distance -= hit.distance;
}

var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;

transform.rotation = rotation;
transform.position = position;
}
}

function Update () {
if (Input.GetMouseButton(0)) {
transform.Translate(Vector3.right * -Input.GetAxis(“Mouse X”) * moveSpeed);
transform.Translate(transform.up * -Input.GetAxis(“Mouse Y”) * moveSpeed, Space.World);

}
}

static function ClampAngle (angle : float, min : float, max : float) {
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return Mathf.Clamp (angle, min, max);
}

why no people give me an answer, Is this too easy to answer? Come on, I really need help, Please.

Easy there, its only been 7 hours.

OK, I know the rules. I have waitted for some many days, many more days won’t be a problem : )

you’re asking a very large question there and kind of expecting us to just do it for you.

i personally browse these forums in bed, and its way too much to read/write.

start with a smaller request, i or others may help, and take it from there.

learning is a process.

also, use ` tages. thats just hard to read.`