Discussionmore snapline shit

Posts 1–10 of 10 · Page 1 of 1
more snapline shit
Hi Basically For My snaplines i want the outline to rotate around as the actual direction of the snapline changes, I keep fucking up the math but I'm Really close at the moment

Code:
local origin = v:GetPos();
snapendx = origin:ToScreen().x;
snapendy = origin:ToScreen().y;
snapstarty = ScrH()/2;
snapstartx = ScrW()/2;
local offsetx, offsety = SnapRotate();
if (math.abs(snapendx) < ScrW()*5 && math.abs(snapendy) < ScrH()*5) then
	surface.SetDrawColor(5,5,5)
		surface.DrawLine(snapstartx-offsetx, snapstarty-offsety, snapendx-offsetx, snapendy-offsety)
		surface.DrawLine(snapstartx+offsetx, snapstarty+offsety, snapendx+offsetx, snapendy+offsety)
	surface.SetDrawColor(color)
		surface.DrawLine(snapstartx, snapstarty, snapendx, snapendy)
end
That's the actual snapline and this is the rotation func()
Code:
local function SnapRotate()
	local _x = snapendx - snapstartx;
	local _y = snapendy - snapstarty;

	local snapangle = math.deg(math.atan2(_y,_x));
	
	if (snapangle > 0 && snapangle < 90) then
		_snapangle =  90 - snapangle;
		__snapangle = _snapangle - 90;
	elseif (snapangle > 90) then
		_snapangle =  (snapangle % 90);
		__snapangle = 90 - _snapangle;
	elseif (snapangle < 0 && snapangle > -90) then
		_snapangle =  90 - math.abs(snapangle);
		__snapangle = math.abs(snapangle);
	elseif (snapangle < -90) then
		_snapangle =  math.abs(snapangle) % 90;
		__snapangle = _snapangle - 90;
	end
	
	x = math.sin(math.rad(__snapangle));
	y = math.sin(math.rad(_snapangle));
	print(x,y)
	return x, y;
end
It's Functional but not p; I was wondering if any of you guys were capable of getting this shit gud
ya dude first u gotta quit lua
you are over complicating it
Quote Originally Posted by D3M0L1T10N View Post
you are over complicating it
i ovr comiplat u
Quote Originally Posted by D3M0L1T10N View Post
you are over complicating it
I want rotating snaplines tho and you could do the rotations on a square but that looks gay circle masterrace.
Do you know the spicy codes or not?
Quote Originally Posted by snipwnage2 View Post
I want rotating snaplines tho and you could do the rotations on a square but that looks gay circle masterrace.
Do you know the spicy codes or not?
look at how people do it in meinkraft
-snipsnipsnip tested didnt work-
Quote Originally Posted by iridant View Post
nigga damn just

cam Start3D
renderDrawline (this is an outline)
renderDrawline
renderDrawline (so is this)
cam end3d
Laughed so hard milk came out my nose
how is it so hard to literally use the drawline function and world 2 screen lol
Quote Originally Posted by c0deine View Post
how is it so hard to literally use the drawline function and world 2 screen lol
it could kill you, you never know.
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us