I want to rotate an animated npc character
I’m using:
using UnityEngine;
using System.Collections;
public class Vira : MonoBehaviour {
public float counter;
public Transform from;
public Transform to;
public float speed = 0.1F;
void Update ()
{
from = transform.rotation;
to = new Quaternion(transform.rotation.x, transform.rotation.y + 180, transform.rotation.z, transform.rotation.w);
transform.rotation = Quaternion.Slerp(from.rotation, to.rotation, Time.deltaTime * speed);
}
}
Its giving me an error:
Assets/Vira.cs(16,17): error CS0029: Cannot implicitly convert type UnityEngine.Quaternion' to UnityEngine.Transform’
Why ? If i’m using transform.rotation this would works