playMaker

Author Topic: Theory for a "Radar-alike" [Solved]  (Read 2324 times)

Uttpd

  • Junior Playmaker
  • **
  • Posts: 70
Theory for a "Radar-alike" [Solved]
« on: December 17, 2012, 07:34:38 AM »


I´m trying to build the above image in to my game.

A is the center of a radar window (the big circle). Object B is moving around out of the circle window. I need to get the position Marker (green) to move, tracking object B, along the window circle path.
So that A knows the direction to B, although B is out of sight.

If you can throw in some theory's on how to do it, or maybe some of you have already done something alike? please share

« Last Edit: December 17, 2012, 01:23:33 PM by Uttpd »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Theory for a "Radar-alike"
« Reply #1 on: December 17, 2012, 11:21:47 AM »
Hi,

 This is pretty "easy" actually.

for each player:
-- build a vector P = ( B-A)
-- set the length of the vector P to your radar radius
-- position the player marker using A+P

now you may also want to check that the player is not within the visiblge area of your radar, so simply do a Min() when setting the length of p, so that if B is closer than the perimeter, it will take that into account at no extra work for you.

 Does that make sense?

bye,

 Jean


 

Uttpd

  • Junior Playmaker
  • **
  • Posts: 70
Re: Theory for a "Radar-alike"
« Reply #2 on: December 17, 2012, 01:22:47 PM »
yep!
I add to keep telling myself  - Jean must be right! - for a while
.. and off-course you are

This is my base FSM for the thing for anyone cruising the same waters



PS: Many of the Vector3 actions are not documented. I´m sure there are some nuggets in there I don't have any idea how to use like the "set hands position"...