I have been trying to make a minimap lately that doesn’t need to have multiple duplicated objects of the map in the viewportFrame or the script being too complicated.
So I decided to make a singular part that contains an image of the map. This image moves along with the player based on its relative position of the map’s center, but I haven’t been able to correlate it well. I’ve been trying to tweak things but I just assume the whole code is a mess. The map moves perfectly once the character moves, but if you move the camera, the whole minimap goes crazy. (Not only that, but the position of the player in the minimap isn’t the same as in the real game world)
Code:
Minimap problem:
Note: The Part is Vertical, therefore the “Z” axis in-game would be the “Y” axis for the part to show in the minimap. The “/8” has been put there just to test things, back then I had it at “/2” for my test map, but my test map was smaller than this one.
Hope you can help me, if you need more details, please ask right away! Have a great day.
Are you looking for the map part to rotate, or the arrow in the center? You can’t have both rotate so im a little confused on your goal. If you dont want the map part to rotate then create a new camera. If not, then that is a different problem in itself.
Ok, so the cursor and the map will rotate at the same time, and the map will move around opposite to the character’s movement. The map can rotate by using the Orientation property and setting it similar to the character’s HumanoidRootPart Rotation, the problem that I’m having is that the map, just because of how I set it to use the “ToObjectSpace” moves the map by a lot just once the HumanoidRootPart rotates, although I don’t want it to move once character rotates but once it moves. It is capable of achieving the movement part but breaks only if the character rotates.
I kind of did what you told me to do, but without a camera. I removed the map rotation, and left it still, although I changed the way of moving the map:
It consists of look vectors for the mouse rotation, making it much more accurate, and dividing the character’s position by the scaled-down map in the viewportFrame. The key was the division, I did a (worldSize.X / mapSize.X) + (worldSize.Z/mapSize.Y) to get a singular number that works as the “ratio” of the sizing. It’s kind of like scaling down the big map to a small map.
This idea I took from this post and code by AnAbsurdlyLongName and edited a few things, as well contributed my own conception of getting an accurate number based on the world’s size and map’s size.
Note: You’ll have to tweak the miniMap’s part size relative to the map’s size for this to work.