Minimap Movement

So i have normal movement down. So im trying to get it so that you can click somewhere on the minimap and your character will walk to that area. This is a lot harder than i thought it would be and i have been working on this for hours and still no luck. Any help would be greatly appreciated!



	function PANEL:Init()
		self:SetSize( ScrW() / 6 + 5, ScrH() / 5 + 5 )
		self:SetPos( ScrW() - self:GetWide(), 0 )
		self:ParentToHUD()
	end
	
	function PANEL:Paint()
		moba.CamData = {}
		moba.CamData.angles = Angle(90,CameraAngles.y,0)
		moba.CamData.origin = LocalPlayer():GetPos()+Vector(0,0,500)
		moba.CamData.w = self:GetWide() - 5
		moba.CamData.h = self:GetTall() - 5
		moba.CamData.x = ScrW() - moba.CamData.w
		moba.CamData.y = 0
		draw.RoundedBox( 0, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
		render.RenderView( moba.CamData )
		draw.RoundedBox( 1, moba.CamData.x + moba.CamData.w / 2 - 3, moba.CamData.h / 2 - 3, 6, 6, Color( 255, 255, 255, 255 ) )
	end
	
	vgui.Register( "Minimap", PANEL, "Panel" )
	
	minimap = vgui.Create( "Minimap" )


This is the code that i have for normal movement:



if ( input.IsMouseDown( MOUSE_LEFT ) ) then //Moving
	if gui.MouseX() < ScrW() - ScrW() / 6 or gui.MouseY() > ScrH() / 5 then  // This way, only clicking in areas that are not inside the minimap will allow your character to move
		local vector = gui.ScreenToVector( gui.MouseX(), gui.MouseY() ) * 99;
		local tr = util.QuickTrace( moba.campos, moba.campos + (vector * 10000), LocalPlayer() );
			
		net.Start( "mb_GoPos" );
			net.WriteVector( tr.HitPos );
		net.SendToServer();
			
		moba.waypointDelay = CurTime() + 0.4; //Stops them from spamming, also max age of bot path
	end
end


I’m not sure if you’re trying to implement navigation into this or not, but if you are trying to implement navigation I would recommend you research the A* path finding algorithm. As for actual movement calculate a set of way points and simply set the player to look towards the next way point with SetEyeAngles and have the player continually walk forward.

I’m pretty sure someone around here made a working system which does this.
Search the developer discussion section for Diablo.

[editline]
me search.
[/editline]
Found it:
Diablo Style Gamemode 2 (DSGM2) made by awatemono in gamemode releases.
He changed it to an addon after releasing that thread which should be compatible with anything. See if you can work it into your project.

The problem is not with regular movement. Movement works perfectly. Im trying to just implement movement into the minimap.

The minimap hovers over your head right?
Find a multiplier which serves as the scale of your minimap. (based on how high it is. Make sure camdata.ortho is true.)
Then, upon clicking on the minimap, get the x and y of your click and multiply that by the minimap’s scale multiplier.
This should give you a localized 2D map coordinate based off the player.
Add this coordinate to the player’s global position and you have a globalized 2D vector.
Finally, add the Z coordinate by tracing a vertical line downward from the 2D vector. Start the trace at the camera’s z pos with the coordinate’s x and y pos, essentially placing it above the player’s head. Wherever this trace hits is your waypoint.

If you need more specific help I can see about it.

Thanks ill give it a go, i will post the results back here

Also when i rotate my camera angle, i set it up so that the minimap on the hud rotates along with it, how would i implement that in?