What is wrong with my rotation code? (i am new to coding)
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class RotatingObstacle : MonoBehaviour {
public float rotationSpeed = 5f;
void Update()
{
transform.rotation.y - rotationSpeed;
}
}
this is my code for rotating obstacle but it doesnt work? what did i do wrong? i get error: "error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement" but i dont know what that means.
Answer by Ginxx009 · Dec 29, 2017 at 03:47 AM
Hmm.
public float rotationSpeed = 5f;
void Update ()
{
transform.Rotate(Vector3.up, speed * Time.deltaTime);
}
or maybe
public float rotationSpeed = 5f;
void Update ()
{
transform.rotation.y - rotationSpeed * Time.deltaTime;
}
I don't know if it will work. Go try it out :)
Your answer
Follow this Question
Related Questions
Unexpected Symbol 'break' 2 Answers
how do I rezolve "look rotation viewing vector is zero"? 1 Answer
FormatException: Input string was not in the correct format 0 Answers
What is wrong with my script? 0 Answers
Simple Rotate Script won't work! 2 Answers