i need help with pathfinding ive read articles abt it but it is still confusing for me
Hi @plok_cxz,
What game are you creating?
AI and pathfinding in games are very generic problems. The proposed way to approach and implement a solution varies a lot, depending on a lot of factors: platform, game type, game size.
hi @Leonidas im making a 3d game a puzzle/fps game and right now we only have one level established
Do you need an AI for the player, a âhumanâ enemy or moving obstacles?
@albertos i need it for an enemy (sry for late response i dont get notifications in blender)
If I have some time I can try to help you with the first things you need for an enemy AI. However, it is quite a lot of work to make a good realistic enemy AI.
ok is it also possible to have one thats friendly follow the player around?
Yes, we can make that.
First things you need to do is making character entities with a script, collision and a rigidbody.
@Albertos finished
Also create a level with soms obstacles. Obstacles also need a collision and rigidbody.
Can you tell me in detail what kind of game you want to make? What is the theme and what is the purpose?
i have some obstacles done with those components also the kind of game i want is like a game series if follow called karlson if you search dani on youtube he has a series about that game its a fps the theme is a futuristic type and the purpose is to get an object
Ah coincidentally I saw some videos of him yes. But if you will make something like that you have to be able to program very wellâŚ
ok but a simpler version of it
also i added you to the project
Next step is to check if the other character can see the player. To do this you have to create a raycast from the character to the player. Then you have to check if the raycast hit a obstacle or the player. If the raycast hit the player the character can see the player and you can start an action.
thats the one thing ive been researching on how to do because im not familiar with raycasts
Iâm not on my laptop right now but in the initialize function you have to do something like this (if the name of your player character is Player):
this.player = this.app.root.findByName(âPlayerâ);
And in the update you have do something like this:
this.app.systems.rigidbody.raycastFirst(this.entity.getPosition(), this.player.getPosition(), function (result) {
if (result && result.entity.name === "Player") {
// player visible
}
});
in a new script
In the script dat you have created for the enemy. If you donât have created a script then you create a new script enemy.js and add that script to the enemy entity.