unity isn't recognizing quaternions
I get the error Assets/scripts/enemyTurretRotations.cs(33,26): error CS0103: The name speed' does not exist in the current context and the error Assets/scripts/enemyTurretRotations.cs(35,34): error CS0103: The name
Quarternion' does not exist in the current context
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class enemyTurretRotations : MonoBehaviour {
public float rotateSpeed = 0.6f;
public GameObject T90parent;
public enemyAttack enemyAttackScript;
public GameObject player;
public bool rotate = false;
// Use this for initialization
void Start () {
T90parent = gameObject.transform.root.gameObject;
enemyAttackScript = T90parent.GetComponentInChildren<enemyAttack>();
player = GameObject.FindGameObjectWithTag("Player");
}
// Update is called once per frame
void Update () {
if (enemyAttackScript.attack)
{
rotate = true;
}
if (rotate == true)
{
Vector3 playerDir = new Vector3(player.transform.rotation.x, player.transform.rotation.y + 0.0f, player.transform.rotation.z) - transform.position;
float step = speed * Time.deltaTime;
Vector3 newDir = Vector3.RotateTowards(transform.forward, playerDir, step, 0.0F);
transform.rotation = Quarternion.LookRotation(newDir);
}
}
}
what am I doing wrong?
Answer by TheRussianBrit · May 26, 2017 at 03:35 PM
i didn't notice that thank you that fixed it. with the speed I forgot to add a float.
Your answer
![](https://koobas.hobune.stream/wayback/20220612122805im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to create a script for a vehicle fuel? 0 Answers
ArgumentOutOfRangeException is occuring when it shouldn't 0 Answers
Manual GUI Refresh 0 Answers
How can i make my spaceship to land automatic on the Base ? 1 Answer
Using Polymorphism Override 1 Answer