playMaker

Author Topic: Move towards and return  (Read 1546 times)

Mark975

  • Playmaker Newbie
  • *
  • Posts: 1
Move towards and return
« on: October 23, 2016, 02:16:25 AM »
Hi there!

I'm fairly new to Unity and Playmaker and I'm trying to figure out something. I have a player and an object and I wanted to have the NPC move towards the player, after it reaches towards a certain distance, and then after the player moves away a certain distance the NPC stops and returns back to the original position in which it rinse and repeats.

Thanks.

Raknill

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Move towards and return
« Reply #1 on: October 24, 2016, 01:02:08 AM »
I don't have a detailed answer (hopefully someone else chimes in with one), but it sounds like you're making some basic guard AI. Just wanted to plug this AI series. I ended up going with Behavior Designer for my AI, but this series helped me understand some basics of Playmaker, and would probably help you in this department.

https://www.youtube.com/watch?v=EFo7vd-L9ug&list=PLCFBBA6A7A7BB34F8

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: Move towards and return
« Reply #2 on: October 24, 2016, 05:39:52 AM »
Save the distance between player and NPC to a float variable using...

Get Distance
https://hutonggames.fogbugz.com/default.asp?W187

store this number and use it with..

Float Compare
https://hutonggames.fogbugz.com/default.asp?W80

If the distance is greater than - end or start the whole thing again. If it's less than, move the NPC toward the player.

Something like that should work.