- Home /
Enemy path following?
Hello. How can I have it so that enemies follow set paths (like the ones here, or in most space shooters) AND, once I have the paths set up, have an enemy randomly choose one to follow? Thanks.
Comment
Answer by denewbie · Dec 11, 2010 at 07:38 AM
- Set up coordinates for each path.
- Use the transform look at function to cause the unit to face the coordinate.
- Use the Translate function and Vector.forward to move towards the coordinate with respect to delta time.
- Use Vector.distance or use colliers and triggers to check if it has reach it current targeted way point and set its new targeted coordinate.
- Use Random.Range function to allow randomization of paths.
If you need more comprehensive sample codes please ask. But personally I think coding is part of the fun. =)
If you would, a sample script would be great (I am not much of a coder). Thanks :)
Your answer