- Home /
Mouse flying
Hello. I'm new to coding, but, i found some codes on internet, you can fly with mouse, but there isn't any code that allow you to fly upwards or downwards with mouse... My actual code is there:
var rotateSpeed = 25.0;
var speed = 50.0;
function Update() {
var transAmount = speed * Time.deltaTime;
var rotateAmount = rotateSpeed * Time.deltaTime;
if (Input.GetKey("w")) {
transform.Rotate(rotateAmount, 0, 0);
}
if (Input.GetKey("s")) {
transform.Rotate(-rotateAmount, 0, 0);
}
if (Input.GetKey("a")) {
transform.Rotate(0, -rotateAmount, 0);
var speed = 0;
}
if (Input.GetKey("d")) {
transform.Rotate(0, rotateAmount, 0);
}
}
You can rotate by a and d, go backwards by s and forward by w, but if i look up or down, it don't do anything... Can you please help me? I know it is now overlooked, but i'm new to forum too :). So if there is good soul, that help me, please respond. Thank you. And sorry for my english, i'm not from England or America.
MinoMMN.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to lock the Z axis so my Enemy just flips on the Y axis 1 Answer
Problem with forcing objects to a 2D plane 1 Answer
SideScrolling Mouse Pointer Aim - Help 0 Answers
Why is my camera switching angles? 0 Answers