top of page

Seek AI and Prop hunt refinement

  • zm02stor
  • Oct 3, 2022
  • 2 min read

Fixed the seek ai, cat now follows player smoothly and rotates towards them without needing to remove rb component. This was done using the Quaternion.Slerp function, I inputted the displacment vector between the target and the cat. This successfully rotates the object towards (or away) from the target.




Cat can now seek the bait using a find obj with tag bait, it finds a certain one each update

So it refreshes once deleted

Only problem is cat getting stuck in wander once distance to bait is >15

The cat will not find the nearest bait instead it will select one randomly from the scene view




The cat will ignore the one closest to it because that is not the bait it is searching for

Even if the bait has been eaten (one closest to) it is only because it collided. The current target will not be updated


I will need 2 functions:

1. To search for the top 3 nearest bait and put them into a list. When it eats one in the list the next one will be chosen next to target

2. At the start of the game set the bait to seek the closest one before checking distance (so it will decide to wander or seek after the bait has been selected


30/09

Tested out what parts of wander works and what doesn’t. the cat WILL seek if it happens to run within range of the treats. The problem comes when there ISNT any bait in the scene. It will only wander if the distance between the cat and the food is >15 which means if the bait is no where to be found, the cat will not wander in the scene.

I focused on the prophunt, fixing up the colliders, the items in the scene now have appropriately sized colliders so the player can fit into the scene. The capsule collider is deactivated for the player so they will no longer send objects flying, it is reactivated once the player reverts back


1/10

Found out that running a findgameobjectbytag every update frame is very expensive for the CPU. I commented out the code for the seek bait for the time being since I know it works, until I can figure out how to optimize it. Research will need to be done.

In the meantime I started on the enemy AI. I applied the Seek behaviour to it when the player is within the trigger for > x seconds. The enemy will follow the player when they are in view for the duration of specified time (a basic version of suspicion)

This will later be changed to a scalable LOS


Enabled the pickup script to the player so they can now pickup cats. The cat correctly faces the right way by getting the hands forward transform. The glitch with getting more than one cat Is still the same – needs fixing. The cat is also dropped when the player collides with the enemy. The code for pickup does not however recognize that there isn’t a cat and so you cant pickup more cats after you respawn. This needs fixing


[2/10] Planned Gantt Chart for Final year project

Recent Posts

See All
Adding a player base

The player still did not have a safe space where they could stay in, or where the cat's cannot run into during their wander state. I...

 
 
 

Comments


ZAHRA MIAH

©2022 by Zahra Miah. Proudly created with Wix.com

bottom of page