Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Uttpd on December 17, 2012, 07:34:38 AM

Title: Theory for a "Radar-alike" [Solved]
Post by: Uttpd on December 17, 2012, 07:34:38 AM
(https://lh5.googleusercontent.com/-j3YEiCjkE0Q/UM8N15REHQI/AAAAAAAAAUk/CQtwcsK29O8/s422/Markers.png)

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

Title: Re: Theory for a "Radar-alike"
Post by: jeanfabre 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


 
Title: Re: Theory for a "Radar-alike"
Post by: Uttpd 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

(https://lh5.googleusercontent.com/-qY2TlNrAZw8/UM9f-C4UGaI/AAAAAAAAAVY/XM4oa8nQRzY/s483/radarish.png)

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"...