This is my first time asking any questions here, so I might be missing something really obvious. I’m generally new to writing scripts, and got caught up with the fact that in one of my scripts, transform.eulerAngles.y came up as a number, while in the current script I am writing, transform.eulerAngles.y seems to be coming up as a boolean. Again, I’m probably missing something very obvious or am making a beginner’s mistake. My script should be attached if the code doesn’t come up properly in my post. Hopefully, someone can aid me.
var anim : Animator;
var speed : float = 10.0;
var rotationSpeed : float = 100.0;
var move = transform.eulerAngles.y;
function Update (){
if(Input.GetButton("Vertical")){
var horizontal : float;
var vertical : float;
if (0 > move > 90){
horizontal = 1 - (move / 90);
vertical = (move / 90);
}
if (move == 0){
horizontal = 1;
vertical = 0;
}
if (move == 90){
horizontal = 0;
vertical = 1;
}
if (move == 180){
horizontal = 1;
vertical = 0;
}
if (move == 270){
horizontal = 0;
vertical = -1;
}
if (91 > move > 180){
horizontal = -1 + (move / 180);
vertical = (180 / move) - 1;
}
if (181 > move > 270){
horizontal = -1 + (move / 270);
vertical = -1 * (270 / move);
}
if (271 > move > 360){
vertical = 1 - (move / 360);
horizontal = (move / 360);
}
transform.Translate(horizontal, 0, vertical);
}
}
2661886–187685–PyroController.js (1.13 KB)