- Home /
This question was
closed Jan 25, 2013 at 04:33 PM by
AusAndrew19 for the following reason:
Made mistake
Question by
AusAndrew19 · Jan 25, 2013 at 04:56 AM ·
raycastaienemy
How to stop enemy shooting through wall
Wrong Script i posted.
Comment
Answer by Imankit · Jan 25, 2013 at 05:03 AM
Its not LineCast... It should be:
if(Physics.Raycast(transform.position, target.position, hit)){
if(hit.transform == target){
return transform = target;
}
}
// In your script hit.transform and target will be the same if the raycast hits the target
So.. I replace "Linecast" With what you posted.. I tryed but im getting a error... I added your code "Replacing linecast" But im getting "$$anonymous$$ Identifier "Hit"
edit.. I also had to add a semicolon in "return; transform = target;"