dave2011
|
  |
| Joined: 02 Oct 2010 |
| Total Posts: 10581 |
|
|
| 21 Apr 2016 11:24 PM |
I have a NPC I want to follow another NPC and attack it with a sword (.Activated), I am using pathfinding service but I have two questions:
is there an efficient way to detect when the path needs to update/an efficient way to update the path when the target moves
and
how would I go about rotating the NPC with the sword to aim the sword at the target (so that it doesn't swing to the side or something)
|
|
|
| Report Abuse |
|
|
dave2011
|
  |
| Joined: 02 Oct 2010 |
| Total Posts: 10581 |
|
| |
|
|
| 22 Apr 2016 01:35 AM |
| Well since your assuming your target would be moving all the time, computing a new path every time the target moves would be laggy. The way i would do it is make it the AI walk a max number of 8 steps then refreshing its path. If the AI gets close enough say about 20 studs, loop the :MoveTo() function on the target's torso. This way should also fix your sword problem. |
|
|
| Report Abuse |
|
|
dave2011
|
  |
| Joined: 02 Oct 2010 |
| Total Posts: 10581 |
|
|
| 22 Apr 2016 08:13 AM |
but walking to the targets torso there is a possibility the target is turned sideways and the sword wont hit him it will go behind him
|
|
|
| Report Abuse |
|
|
dave2011
|
  |
| Joined: 02 Oct 2010 |
| Total Posts: 10581 |
|
| |
|