Rotate the minimap?

Make sure the minimap and map are on different layers.

Can you screen shot the events that spin the minimap around? It may be something simple that’s causing the issue.

The issue is getting the mini map to move freely but only rotate around the center of the lense instead of the center of the map object. I can’t screenshot because i’ve tried about 15 different things and none of them worked: either the map rotates properly but cant move or it can move but doesn’t rotate properly. I just assumed something like this would be trivial and I was just missing something obvious but I guess I’m the first person to try this? Lol

At this point I’m brushing up on my trigonometry to just brute-force it.

Hello @Sage ,
If I understand your question, you have to change the rotation origin point.
Try with this command:


and let us know

That relocates the map object so its center is at the specified location.

Is this what you need?

I need the map to always rotate around the center of the minmap circle regardless of its position.

If there was a way to change the center of rotation of an object dynamically that would be exactly what i need, but I’ve found no way of doing that; I don’t think it is possible.

I did not test it i did not use it my knowledge is same as yours about it so if you can’t answer question about it then for sure i also can’t

BUIUUUUUT

This extension claims it can set center point of something
Sooooo

1 Like

What object is the minimap? How are you creating it? Can you share a screen snip of the events that update the minimap? All the answers so far are guesses because we have no idea how you are doing it.

You’re right.
I’m triing to write an example for you but it’s not easy. Sorry

Hi there! I’m guessing you’re looking for a minimap rotation similar to NFS U2 or maybe Vice City?
If so, here’s my attempt at replicating it.

What I did here was that I set a reference point object on the center of the main map, “RoomCenter”, used to get the relative location of the player object “CharPlayer”.
Then I also set up a player marker object on the minimap, “CharMini” for setting the relative location of the center of the minimap.
And another object, “PivotMini” which will be the makeshift center of the Minimap when it rotates.
On the computations, there’s a “+90” to the total angles, that’s to make the 12 o’clock as the main direction where the player is facing. By default 0 degrees is to the right, or at 3 o’clock.
Finally, the divisor “/2”, that’s the scale factor. So here the minimap is half the size of the main map.
Maybe someone might know how to optimize it or have a simpler way of doing it? idk. Also while testing, I noticed an occasional wobble while rotating… i don’t really know where that’s coming from, maybe the sprites I used or the math needs further tweaking or something…
So yeah, hope it helps.

I would assume wobble comes from events order
Every single time i had issue with text object flickering when changing text
For example i set it to display score variable
And it flickers as soon as score changes due getting new digit
For example when it switches fro 99 to 100
Look at my post here

You have there 2 gifs
Top gif have that issue as soon as new digit is added to string it flickers
It is due it is positioning itself based on length of string (since origin point is on the left)
And then it update position and so there is delay between how long string is now and when position is updated
I never can remember does position change action should be above or below text change action
But it is one way or another

And as you see that 2nd gif with negative numbers does not have that problem
I made it after figuring out why it is flickering

And so in your case i guess in one action you change angle or something
And other action that is above it updates it
And that is the problem

I simply suggest mess around with order of your actions/events
And it will be fixed

And i would care to ask
What does SIN do there?
I do not know what it does so what is the purpose of this expression and how it works??
Damn also what COS is cause i guess they are opposite of each other?

1 Like

Uh… I’m not that good with math, mind you, but from what I understand is that
SIN is used when computing for the Y value since the Y axis is assigned as the “opposite” side from the angle in question.
The X axis, on the other hand, is assigned as the “adjacent” side from said angle, so COS is used to compute for the X value.
From what little I’ve been able to retain from high school, SOH CAH TOA have been useful after all. lol. Oh and ToRad is used to convert them to radians but I believe you already know that.

So, anyway, in this particular setup, we use Cos and Sin to get the X and Y and coordinates for the minimap objects based on the angles and distances of the objects on the main map. Then we also have to account for the angle change for when the minimap rotates hence, PivotMini.Angle() is added to the equation. And of course, (for the sake of completion) the +90 to make the minimap face upwards, and the distance value / 2 to scale it down… uhm, yeah, I hope that didn’t sound too “lecturey”.

To be honest, I still have a bit of trouble wrapping my head around it sometimes. Like that +90, at first I thought it should have been +270 (or -90) due to the rotation of the angles in the engine. But then I guess, it must be due to me setting the RoomCenter as reference point instead of the CharPlayer. I thought of switching it up but then I’m afraid it might affect the other values. And you know what they say, “If it ain’t broke, don’t fix it.” lol.

Alright, so I also did what you suggested and changed the order of events. I found that putting the PivotMini rotation on first, that got rid of the occasional wobble. Also I just put them all in one event. I’m currently not yet using this rotating minimap thing, but I do happen to be planning to implement it in one of my projects at a future time. I guess that’s one less headache for future me, lol.
Thanks!

HAHAHA thx but
I do not ask for math explanation
I ask for explanation/example in human language
I understand from what you wrote as little as from all wiki articles i did read

You really need to give me bare bones example why it is needed here
Like assume i am dumbest user you ever meet

I mean i do understand part that “in this situation we use this and in other situation we use that”
I do not understand why and what it does

I know how ToRad works sadly
I also am making minimap yet mine is dynamically drawing itself with shape painter

Do you think same magic would by possible with my minimap?
I mean i bet it would
Yet my minimap do not use any kind of objects
All is drawn from positions of objects in actual game
So i have no idea how to translate what you did there to my minimap
By now i upgraded it a lot from what is in the post there
(i am still making example out of it)

I would assume i would need to draw crap based on rotation of player
And here i have same problem as OP
How to account for X and Y offset

For example this is all the crap i use draw objects from weapons object group
And so as you see on minimap skeleton throw axe
Axe spins even on minimap

This version is drawing crap based on camera position
I have also version which draws crap based on player position
If i would be able to adapt your idea into my minimap
I wonder would logic be the same
Where i calculate everything based on position of camera or player and just add angle into the mix

If you care for challenge i could provide updated version zip

And more or less it looks like

Sorry, I am a bit at a loss how to explain in human language… I’ve been with the lizards for too long… kidding… but dumbest? really? You’re like one of these pros on here. And looking at your events… that’s a tad advanced for me… alright, you’re definitely pulling my leg. Though I could probably get that… give me a couple of months or so. Maybe six or seven just to be sure. lol.

But okay, I’ll bite. And also for the sake of others who might stumble into this post. Though, I still don’t really know how to explain the thing without getting into the maths, but I’ll do my best to simplify it… I hope… And here, I thought a bit of illustration might help.

AnglesExplanation2

So first the question, why is it needed? Imagine a player object on top down map, has a crosshair, 100 pixels away. The player turns 45 degrees to the right. Would the X and Y coordinates of the crosshair be just 100 for both? or -100 if he turns 45 degrees left? Obviously it doesn’t work that way. Computations have to be made. After making proper computations it’s x=70.71 and y=-70.71. Witchcraft! Oh and that’s only if the player is at coordinates(0,0). What if the player moves? What if the angle is 50 degrees? etc… Panic mode! There’s a way! Calm… More maths! Panic mode!

AnglesExplanation

  1. This should be what it looks like to the engine. There’s a reference point (R) and a target point. We know the X,Y coordinates of R. We don’t know that of the target. That’s what we’re trying to find out. But we know the distance (H) between the R and the target. We also know the angle it would make on the main map.

  2. Is what it should look like in the minimap. Exactly the same thing but smaller, distance is scaled down. So the angle used is exactly the same as from the main map, but applied to it’s own reference point and target and with the distance calculated to be smaller using a scale factor.

  3. Is how X and Y axis are usually referenced.

  4. That Y axis reference is the same value if it were to make a triangle. We just imagine it to be right there as the opposite side of the angle.

  5. Now we have us a triangle. Everything needed to compute for the X and Y of the target is right there. The angle from the reference point, the hypotenuse(H, distance), the adjacent side of the triangle (X), and the opposite side (Y).
    The computations, of course, involves the use of Sin and Cos. Sin = opposite/hypotenuse (SOH); Cos = adjacent/hypotenuse (CAH);

  6. What happens when it spins or the target and/or the reference changes position? The angle would change and perhaps the distance also, but the numbers we need are still there. Same concept applies. We just recompute using the new values, then we are able to account for the X and Y offset.

Though now that I think about it, the simplest might be to think of Cos just as a way to get X, and Sin as a way to get Y. Does it help to know how they do it? I honestly don’t know. Although it’s probably better to know than to just use them blindly. But like I said, i’m not really that good in math so don’t take my word for it.
So there it is. Thank you for coming to my ted talk… lol.

Anyway, your project, I’m not quite sure how you intend to use rotation on your minimap. But if it’s not going to rotate, just a minimap on a fixed plane, yeah, the concept should work pretty much the same. And you wouldn’t need an extra angle calculation to account for the spin.
Here’s an event from one of my projects that involves a fixed radar:

For each axis X and Y, it’s got just one angle to account for together with the distance (the 180 is because I switched the reference and target again. I gotta start paying attention to these things. lol)

So your project drawing stuff as it goes along, yeah, I think it can work too. Do forgive me though, I still haven’t wrapped my head around all that stuff in your events. heh… But in the event I provided for OP, I noticed that it’s possible to not actually have to use the PivotMini object. Just get the raw calculations and apply them directly to the event.

So yeah, I suppose your project could do likewise. Like, drawing is being done on coordinates (28, 42) there’s the x and y, then use those coordinates to get an angle and distance from a reference point, apply to minimap. Though I have to admit, making theories is easy enough, but when actually creating the events for them… yeah, not so much.

Man, I hope I didn’t make my essay too long…

1 Like

Longer it is better someone can filter which info will help achieve what he want

And for me as simple as cos for X and sin for Y is all i needed to know here
I do not understand what exactly it does
I just needed to know that cos gets X and sin gets Y
Yet i do understand most of what you wrote but in the end rest is just like I WILL KNOW and that’s all
This is not kind of knowledge i need to have
Think of it as i know i need to add water to a cake to not burn it
I do not need to know what water is doing exactly and how

But damn you that gave me very good idea of what to do and how regarding minimap rotation

AND just for record
I know how to fix pc replace motherboard elements how to diagnose which resistor on motherboard is broken
YET i have no idea how to fix anything in a car
Just because i have knowledge in one aspect do not believe even for a moment i am pro or whatever
I understand some stuff while in other areas i am as green as new users
For example i am almost 2 years here yet i have no idea how to handle physics
I was able to get coins bounce off the ground by trying every possible combination in physics properties
And that is end of my knowledge
Yet i see ppl that use gdevelop for less than month and are making bloody ropes/chains out of physics WTF?
And who is more pro now?

On other hand i also answer questions on discord of ppl that are here far longer than me and made a lot more advanced/complex games than i could imagine

THX to you for that knowledge
I just realized my minimap should automatically work with rotation
I just need to add something to calculate based on rotation

You see in that screenshot from my events you trying to find some ultra cryptic advanced crap
If you look closely there are 4 variables GX Y W H as in Xpos Ypos Height Width
And every single math there is calculated based on that
So even so formula is long if you would change for example GX+blablabla/2*something whatever
You would get for example just 10 as a number

But i think i will manage from here on
THX A LOT what you wrote really helps

1 Like

Well, there it is. You just simplified it best. Cos to get X and Sin to get Y. And here I was thinking a bit more info was needed. lol.

And yeah, it’s true, for everyone, there’s always room for learning and growing. Reminds me of those movies where for all Tony Stark’s genius, along comes this kid, Peter Parker dishing out seemingly simple ideas that Tony could never dream of. Ah I digress. But it is just like you said about those new guys that take to gdevelop like a duck in water. I say, “I’m not even mad. That’s amazing!” Those guys are probably genius level all the way up there.

Anyway, for now I’m just happy my little contribution to the vast collection of knowledge in these pages are found helpful while at the same time I continue to learn new stuff as well. So yeah, you’re welcome and thank you also for your ideas. I intend to continue to peruse the events of your minimap that you shared, I think I get the gist of it, though I’m pretty sure that learning will get much, much faster when I find one of my projects needing it. Heh.

Now we wait and see if anything in this discussion hopefully solves OP’s question. Cheers!

Do not think even for a moment your wall of text was for nothing
I you just told me that water is for cake not to burn it in oven
And oil is for fries
I do not understand why but for now i am occupied with my other game
I was making farming game then i wanted to add to it menu
Then i wanted to add boomerangs (still working on curve paths)
And i kinda made it space shooter on farm with satellites
And nothing there make sense


Just don’t question stupidity

I guess i will need cos and sin for that path part for curved boomerang part cause i think it will be better option to set path instead of just add force and manipulate boomerang while its flying
BUT when i get to that point i did save link to your explanation and i gonna look closely into it and try to understand what exactly it is doing and why
Then i will have easier time trying to apply it to minimap
Same way i believe i need cos and sin for this

I am able to dynamically put satellites on each side of player
Yet what if i would want this


BTW satellites on previous screenshot where then line up on sides rotate toward cursor around player
So if i put cursor on right from player
Satellites will line up vertically
And same thing i need to apply to my picture with irregular side postions
They should rotate toward cursor position in that formation

I have perfect idea how to set it up via events manually
Yet i want to set it up dynamically via some equations
Taking into account how many satellites i have
And shove in there different variables to get different formations for each satellite or at least control them to some extent

And after i am done with that i am back to minimap
So your explanation will for sure not go to waste
And i am really tankful for it

And relax one day you will find yourself like
OMFG i can do that
That will be the moment when your knowledge gained here will pay off
Wanna see how i started here?
All my posts are here just go to my profile
We all started somewhere

Don’t give up and keep learning

Farming game… then boomerang… then space shooter with satellites. Well, that escalated quickly. lol. Yup, sounds crazy and fun. And now that I think about it, I too, have been using the equation for satellites and formations a lot. Like a lot. Definitely made life easier. I just didn’t consciously take notice of it. I’m like, “Eh, okay, just another triangulation thing…” Apparently, I didn’t appreciate it enough.

Anyway, like you say, keep learning, yeah, I do intend to do just that. Right now I’m somewhere between, “Ah I know how this is done.” Proceeds to tear out hair because the thing isn’t working. and “How is this done?” Sits for hours wondering why it’s working. Hahah. It’s good to keep growing.

I do appreciate your appreciation of my essay. Thank you very much for your kind words, good sir.

1 Like

Ow Levio damn you
I would give you big sloppy kiss if i could

You see i still don’t understand how cos and sin works
YET
I know what they do and when i need them

I needed it so bad so many times and now i can simply abuse it finally
I just didn’t know they are what i need to offset position of something that is rotating around something else
And here is perfect example of it

2024-04-28_10_05_k14aMQY3Du_GDevelopRed

Press tilde to reset scene (button above tab/below escape/left from 1)
LMB to throw boomerangs if you care to try it out
RMB to spawn satellites
RMB while they are spawned to spin them faster and shoot additional satellites
1 to change satellite skin
2 to change their size
3 to change formation
When satellites are spawned MMB to spawn flamethrowers
Look how i was able to offset them THX to your explanation
Hold Space to change opacity of flamethrowers hitboxes

Quick guide
1 - Press right mouse button
2 - Press 3 four times
3 - Press middle mouse button
4 - Hold space to cycle trough opacity of flamethrowers of hitboxes

Trust me your knowledge written in this topic will not go to waste
I will study it further to find other applications

I edited this post after you wrote your reply and i pasted here updated link

Now

  • Tilde resets scene
  • LBM throw boomerangs (you can hold it)
  • RMB spawn satellites
  • RMB when satellites are spawned to shoot projectiles (Hold RMB to charge bar on bottom to dispel satellites also doubles size of boomerangs and speed up rotation for formations that don’t follow crosshair)
  • Middle mouse button to spawn flamethrowers (MMB again to dispel them)
  • 1 change satellite/projectile skin
  • 2 change satellite size
  • 3 change satellite formation
  • Holding space changes opacity of flamethrowers hitbox yet it is set to 0 at their spawn
1 Like

Dude… nohomo… lol.
But omg! that game of yours looks fire!
I think I feel you in that this was like how I felt when I first got that thing to work. But you just cranked it up over 10 notches. Haha!
Hail master Euclid and master Pythagoras!

And speaking of other applications, I stumbled into this other topic when I needed something similar for my project. I didn’t want to necro the thing though.

But omg! I swear that game of yours looking fire!
I’m traveling and just on my phone right now, but yeah I’m gonna give that a go when I get to my PC. From farming game to boomerangs to fiery orbs… After all, where’s the fun in being a game dev if you can’t abuse such power, eh? It’s like a diablo2 farming game crossover. lol!

1 Like