- Home /
Bone lookat do not work Help!
Hello, I'm doing a third person shooter and everything goes well except always the same problem of the thorn, I have a target and do not look, what happens in the script? Thank you
using UnityEngine;
using System.Collections;
public class SpineAim : MonoBehaviour {
public Vector3 Offset;
public Transform Target;
public Transform Bone;
void Start ()
{
}
void LateUpdate ()
{
Bone.LookAt(Target.position);
Bone.rotation = Quaternion.Euler(Offset);
}
}
Comment
Answer by xxmariofer · Jan 22, 2019 at 08:48 AM
You are using Bone.rotation = Quaternion.Euler(Offset); so look at wont work change it to this
Bone.rotation += Quaternion.Euler(Offset);
I have this error:
"The operator += can not apply to UnityEngine.Quaternion";
Bone.rotation += Quaternion.Euler(Offset);
Your answer
Follow this Question
Related Questions
Lock rotation axis? 4 Answers
2D LookAt not working as intended 1 Answer
Object Look At Mouse 2 Answers
Limit character head rotation 4 Answers
Rotate my torso in vertical axis towards crosshair (target) 0 Answers