Simple Rotate Script won't work!
My simple script for rotating an object won't work. Please help me! Screenshot below.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraLook : MonoBehaviour {
public float turnSpeed = 100f;
void update () {
if (Input.GetKey (KeyCode.E)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
if (Input.GetKey (KeyCode.Q)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
}}
screen-shot-2017-05-04-at-90219-pm.png
(358.9 kB)
Comment
Best Answer
Answer by CallumWB · May 08, 2017 at 03:27 PM
All it is you are using a lower case "u" like said in the first comment. it like on Void Start both Start and Update both need to have Caps to work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class roate : MonoBehaviour {
public float turnSpeed = 100f;
void Update () {
if (Input.GetKey (KeyCode.E)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
if (Input.GetKey (KeyCode.Q)) {
transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);
}
}
}
here is the fixed Script for you.
I can't believe I didn't notice that simple mistake! Thanks! Cash me outside now!
Your answer
Follow this Question
Related Questions
Drag - Rotate 0 Answers
how to get object rotation? 1 Answer
Rotate object with 90 degrees? 1 Answer
Problems With .rotate behavior 1 Answer
Multiple rotations make a mess! 0 Answers