Uhhh, I’m guessing from the error message somewhere you’re doing something like:
LookAtTarget[0].position
where it should be:
LookAtTarget[0].transform.position
Or maybe you’re mixing the types:
var LookAtTarget : Transform;
var taggedGameObjects: GameObject[ ] = GameObject.FindGameObjectsWithTag(“Waypoint”);
if (taggedGameObjects.Length > 0)
{
LookAtTarget = taggedGameObjects[0].transform;
}
laurie - thanks, iv tried implementing that into the script but cant get it right, im probably trying to add it in the wrong place, heres where iv put it:
function Update ()
{
if (LookAtTarget = GameObject.FindGameObjectsWithTag("Waypoint");
{
var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
thanks FizixMan - i think its only because im trying to use .position with gameObject
but GameObject.tranform is a member of position…so change the relevant things from GameObject to GameObject.transform.
waypoint.position → waypoint.transform.position this should work
…well, it´s the tornado twins tutorial, right?^^ but why you trying to shoot at waypoints? what are you trying to do? well, you also could check your range for your enemies using a raycast or a trigger. a raycast is much cooler, because your turret shouldn´t look throught walls like superman;) and it´s cooler bcause why should a turret at the end of the level knows that you are coming along to destroy it? …but both could activate your turrets. if you´re out of range they will deactivate themself and have got no target…so you don´t need to check for an object with tag “xyz” all the time and you won´t get any error messages, because if there´s no object hitting the range of your turrets with tag “xyz”, they won´t get activated and won´t check for the tag;)
i hope i don´t miss the topic