playMaker

Author Topic: Making minimap blip stick to the edge of the minimap?  (Read 923 times)

stellarGameLove

  • Playmaker Newbie
  • *
  • Posts: 6
Making minimap blip stick to the edge of the minimap?
« on: March 30, 2021, 07:14:15 AM »
Hello, guys.

So, i made the minimap using the orthographic camera and render texture. My blips are basically 3d planes with different tag, so that only minimap ortographic camera can see them. I made those blips rotate based on my character camera point of view, but i have no idea how i can make them stick on the edge of the minimap when the blip is out of the ortographic (minimap) camera sight?

Here is the example of what i want to achieve, blips that stick to the minimap and that their direction is accurate.


Is there any way to do it with playmaker?

Thank you for the help.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Making minimap blip stick to the edge of the minimap?
« Reply #1 on: March 30, 2021, 11:26:37 PM »
You could Raycast from the GameObject to the center of the minimap (camera position?) with a Box Collider representing the map area. You can then use the hit point to position the icon on the edge of the map.

There might also be an action on the ecosystem. If not this does seem like a good candidate for a custom action, something like Vector3 Clamp To Area with options to clamp by axis or direction.

stellarGameLove

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Making minimap blip stick to the edge of the minimap?
« Reply #2 on: March 31, 2021, 06:05:43 AM »
Thanks for the response.

I followed your advice and managed to do some progress, but it's still not working correctly. I agree that some kind of Vector 3 clamp action should be more than welcome regarding this feature.

Here's my progress:
Blip:


Blip original position:

Cube (box collider):

Results:
Not a valid vimeo URLAs you can see, blip won't stick on the correct side of the cube where the og blip is positioned, sometimes, blip will stay on the position when the player changes the direction (if the og blip (static one) is off-the-camera) and blip will often disappear if i go futher from the og blip position which probably has something to do with raycast distance.

I understand it's not perfect solution for radar blips, but what am i doing wrong?

Again, thank you very much for the help.

« Last Edit: March 31, 2021, 06:09:01 AM by stellarGameLove »

Gustav

  • Junior Playmaker
  • **
  • Posts: 53
Re: Making minimap blip stick to the edge of the minimap?
« Reply #3 on: March 31, 2021, 06:34:23 AM »
Hi,

if you decide to use a circular minimap, you can use very cheap and simple calculations without raycasts.

I attached an example Fsm Template. Just drop it on the icon game object. The icon object needs to be a child of the object to follow. The template searches for an object with the Player tag and calculates the distance between the objects and clamps the magnitude.

Regards
Gustav

stellarGameLove

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Making minimap blip stick to the edge of the minimap?
« Reply #4 on: March 31, 2021, 07:45:39 AM »
Thank you very much for the response. Tried it on circle radar and on square, and with visible in camera fustum action and a couple more modifications, it works pretty nice, but it seems like it doesn't show the position of the blip accurately when the blip is off-the-radar, the blip is like 20 degrees off the original position.
Off-camera blip:

Blip visible for radar camera:


Again thank you very much, i might look into some classic script alternatives.
« Last Edit: March 31, 2021, 07:52:56 AM by stellarGameLove »

Gustav

  • Junior Playmaker
  • **
  • Posts: 53
Re: Making minimap blip stick to the edge of the minimap?
« Reply #5 on: March 31, 2021, 08:09:21 AM »
You're welcome. :) In the case of a circular minimap setup with perpendicular and orthographic camera, the template works flawlessly. The blip is always placed on a straight line between the player and the other object, clamped to the max radius. It's not meant to be used in conjunction with rectangular minimaps.
« Last Edit: March 31, 2021, 08:17:03 AM by Gustav »

600

  • Moderator
  • Hero Member
  • *****
  • Posts: 715
    • Flashing Lights
Re: Making minimap blip stick to the edge of the minimap?
« Reply #6 on: April 01, 2021, 03:14:51 AM »
I use UI elements for minimap in my game, make the full map in same proportion as 3d map and drop the UI image under mask, then get position of things in real 3d world and calculate the location to your image location (X,Y), like if the world is 4k then maybe minimap is 2k so position would be divided by 2, later is it easy to clamp the UI element's position to not go over edges.
This way you don't need to render secondary 3d camera and do raycasts, unless of course you need it to be 3d minimap :)