- Home /
Question by
erfan · Apr 09, 2014 at 12:53 PM ·
lookatlookrotationtransform.lookat
transform.LookAt is Reverse !
Hi, I want to , a Cone volumetric light , Show the Dancer in my Party. I use the transform.LookAt
but it doesn't work !! it is Looking 180 Degree Wong , How can i fix this?
using UnityEngine; using System.Collections;
public class LookTarget : MonoBehaviour {
// Use this for initialization
public Transform Player;
public Vector3 originalUp;
void Start () {
}
// Update is called once per frame
void Update () {
transform.LookAt(Player);
}
}
my Out Put is Something like this :
but I want something like this !!
HOW CAN I FIX THIS PROBLEM , THANKS
capture.jpg
(11.2 kB)
captured.jpg
(11.9 kB)
Comment
Best Answer
Answer by Griffo · Apr 09, 2014 at 01:12 PM
Try this, sorry .js
var target : Transform;
transform.rotation = Quaternion.LookRotation(transform.position - target.position);
Or ..
var lookingAt : Transform;
transform.LookAt(2 * transform.position - lookingAt.position);
Glad to help, please mark the answer as correct, the tick, thank you.
Is there a copy of the full code? because I don't know where to put it
Your answer
![](https://koobas.hobune.stream/wayback/20220613142325im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Lookat, FromToRotation and LookRotation? 3 Answers
Look Rotation flipping object rotation after 180 degrees 1 Answer
Turret Rotation Problems 1 Answer
Make player look at pointed target 1 Answer