function OnTriggerEnter (enter : Collider)
{
if(enter.gameObject.tag == "Enemy")
{
transform.LookAt();
}
}
I'd like to get the thing that tripped the OnTriggerEnter to be the target for the LookAt();
function OnTriggerEnter (enter : Collider)
{
if(enter.gameObject.tag == "Enemy")
{
transform.LookAt();
}
}
I'd like to get the thing that tripped the OnTriggerEnter to be the target for the LookAt();
Try:
function OnTriggerEnter (enter : Collider)
{
if (enter.gameObject.tag == "Enemy")
{
transform.LookAt(enter.transform.position);
}
}
Adam,
Your comments - above - set it in the onTriggerEnter, then use LookAt in an update cycle.
Can you give me an example as i am rather new and not sure how to do this.
I would like to mouse down to taret/LookAt/shoot but when i mouse down elswhere i want the taret/LookAt to stop untill i click on the target again.
Thanks