I'm trying to make simple AI for an enemy character. It is a piranha fish that will patrol inside box area. I'd like to have one fixed camera and fish will react on a mouse click. When a mouse click is detected, apply attack piranha animation in the mouse position (Raycasting). When there is no mouse action, fish go back to their path (random waypoints ?) and play idle or swim piranha animations. Please for any suggestion, where to start, which scripts to use and what's the best way make the curve animation smooth? Thanx Andeeee for PM
It looks like maybe you already got an answer (?), but if you're still looking for suggestions, steering behaviors are often used to create the type of behavior you're describing. For the scenario you describe, the 'wander' and 'obstacle avoidance' steering behaviors would likely produce reasonable results. If there's more than one fish, you could also incorporate flocking behaviors. Attacking the target point can be accomplished with steering behaviors as well.
check out the old fps script its lurking around some were just google fps tutorial unity the ai system incorparated can be modified to fit your needs
In FPS tutorial robots are moving along XZ axis. My fish has all 3 directions free and such movement require smooth animation.. What does it mean now? Does I have to update dynamically spline controller (my idea was to generate random waypoints to simulating fish behaviour)?? Andeeee wrote: "You may find Bezier curves or Catmull-Rom splines easier to use if you need to modify the motion path on the fly" Does anyone have experience with this?
I would try steering behaviors first, as I suggested previously. If that doesn't seem like a suitable solution, perhaps you could explain in what way it doesn't meet your needs (as that would make it easier to provide useful suggestions). But yes, you could also use splines for this. If you have specific questions about the spline-based approach, just post them here and someone should be able to help.