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.
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!
-
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.
-
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.
-
Is how X and Y axis are usually referenced.
-
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.
-
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);
-
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…