- Home /
This post has been wikified, any user with enough reputation can edit it.
How Would i toggle the LookAt Off, so object faces origin
Hi Community, Im Learning Boolean's. And Im trying to get the LookAt to toggle Off, Ive Got first bit right I think, but not sure to put at the bottom. thanks in Advance
#pragma strict
var toggle : boolean;
var target : Transform;
function Start () {
}
function Update () {
if (Input.GetButtonDown("Fire1"))
toggle = !toggle;
if (toggle){
print("Toggled ON");
transform.LookAt(target);
}
else
if (Input.GetButtonUp("Fire1")){
if (!toggle){
print("Toggled OFF");
}
}
}
Comment
Answer by belvita · Nov 29, 2013 at 04:02 PM
you wrote
if (toggle){
this means if toggle is true now tell me where it is that you assigned toggle=true? you have never assigned toggle to true so of course it will not work
Your answer
![](https://koobas.hobune.stream/wayback/20220613122232im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Two toggles, only one can be on, both can be off 3 Answers
lookat wont track target 1 Answer
boolean questions get, set, in java. 1 Answer
Toggle Active GameObject State 1 Answer