• Need help with setting up 2D aiming.
    0 replies, posted
Currently its aiming depending on height of the cursor only, causing it to aim 90 degrees up no matter where on the top of the screen I have the cursor, I want it to aim towards the cursor instead. Any ideas on how to do this? [code]diry = 0 dir = 1 function GM:CreateMove( cmd ) if dir == 1 then cmd:SetForwardMove( -cmd:GetSideMove() ) cmd:SetForwardMove( cmd:GetSideMove() ) cmd:SetViewAngles( Angle(diry, 0, 0) ) cmd:SetSideMove( 0 ) else cmd:SetForwardMove( cmd:GetSideMove() ) cmd:SetForwardMove( -cmd:GetSideMove() ) cmd:SetViewAngles( Angle(diry, 180, 0) ) cmd:SetSideMove( 0 ) end end usermessage.Hook( "ChangeOverview", ChangeOverview ) function GM:ShouldDrawLocalPlayer() return true end function GM:CalcView( ply, origin, angles, fov ) ply:ChatPrint(gui.MouseY()/ScrH()*180-ScrH()/12) diry = gui.MouseY()/ScrH()*180-ScrH()/12 -- The direction to aim, bottom of screen is 90 and top is -90. if gui.MousePos() > ScrW()/2 then dir = 1 else dir = 0 end end[/code]
Sorry, you need to Log In to post a reply to this thread.