Behavior on model

Hi there,

I would like to make three differents behaviors for my 3D model : a simple pig.

There would be 3 side-by-side models with 3 different behaviours :

First behavior wished :
the pig don’t move, stay in place, and he watching me when I’m near of it

Second behavior wished :
when I’m near of it, the pig deviate from me, for x distance value (no matter)

Third behavior wished :
when I’m near of it, the pig follow me.

for the first one i would probably use a morph target or animation but this is the one that i personally know the least about.

for number two you would either need to use eqs or do some vector math. basically at a regular interval (timer or tick) check the distance between your pig and the player (vector - vector then get vector length) then compare that value to a set distance. if the distance is below a certain amount then you would find the direction which is away from the player made move to a point in that direction and recheck. the first part of this could also be done with a collision volume by starting the checks when the player begins overlapping.

the third option is probably the easiest. fist have a method to trigger when to start following the player. you could use a collision volume or pawn sensing for this. then all you need to do is use a move to node. when the pig reaches the goal have the move to repeat as much as you like. below ill post a picture of one of the ways i accomplished something similar in the past.

in the script in the picture i had the enemy character pursuing the player right from the start of the game but you could easily change this to a different event of your choosing.

a few last things to note: make sure you have a nav mesh volume in your level or your script may not work. make sure your pig is either a pawn or a character since these are the easiest to get moving and have movement components.