When can we expect to see it?
Bump!
I need to get a sense of how to implement basic AI and pathfinding quickly! Please!
You’ve probably done this, but search the forums for pathfinding and you’ll turn up various discussion/examples.
I have searched, but the content of these threads is either incomplete or totally above my head (or both). I need a tutorial and a sample script that I can modify.
Swapping out file names and tweaking variables is the full extent of my coding ability! ![]()
am i at the wrong end of your stick?..but there a basic ‘pathfinding’ example in the racing tutorial…in the form of waypoints…?
Well what I’m looking for is guidance on creating basic NPCs and enemies.
Hi
Here is a link where you can download a project I created it has pathfinding in it (NPC’s are running through the castle).
I hope this will help you.
By
i’m eagerly awaiting this as well.
that’s for linear paths, not a best/quickest path approach (which you need for NPC’s)
EDIT:
I have yours (thanks!) and the FPS tutorial, both of which have been very helpful but for a programming noob like me, even though i understand in general what is happening, its nice to have everything spelled out for you to understand why things were done the way they were - so part 3 of the tut will hopefully enlighten me so i can modify it for my own needs.
yea, that was more of a quick (basic) fix! as i cant offer any great help with NPC’s at the moment!
Ok. Just the small intro to AI from the shooter example project.
If you fire up the first person shooter example project. You got all the scripts for it in there.
You want to copy out the following scripts:
AI, AIAnimation, AutoWaypoint, CharacterDamage.
You place a couple of waypoints by creating empty game objects and adding the AutoWaypoint script to them.
For your character you add the AI script. That should make him move and run for the character when he is in sight.
To get him to animate, you add the AIAnimation script.
That should basically give you a guy, who runs between waypoints, when you are in sight, he will attack you. Then return. From there just modify the scripts as need be.
That’s all I needed! Thanks Joachim.
Joachim, I’ve got the AutoWaypoint and AIAnimation scripts working just fine. But the AI script is not seeing my player character. I set the target to a game object that is parented to my character.
Where does the raycast for a character originate? Could the problem be a difference in height? My NPC is three meters tall and my player is less than 2 meters tall.
Any other ideas what I could check?
When the script starts, the players are very close. Could that be a problem. I tried changing the various range settings, but I didn’t see a difference. Chasing the NPC through the level never got him to react to me.
/Bump/
Joachim is still at WWDC this week, and I don’t know anything about the AI scripts we has written. Could you wait a couple of days? :roll:
Okay, I guess…I was on a roll. ![]()
The ai needs to find the player.
So You either assign the target manually, by just dragging the player on the target slot of the AI script.
Or you set the tag of the player character controller to be “Player”. This way the script automatically finds the enemey and you dont need to connect it for every ai enemy.
Sorry. That’s what I did and it’s just not working.
So distance doesn’t have anything to do with how the enemy finds the player? Maybe something is set wrong there?
Is the target referencing the character itself. You have to assign it to the game object that also contains the character controller.
Does the character look at you when you move around? Or does he keep patroling?
Yes, the target is the game object with the character controller.
The enemy stays in patrol mode.
Can you send a screenshot of the inspector of the ai guy, with the inspector in debug mode, in playmode when your character is close to the enemy guy.
