Help[Noob] Angle to Position?

Posts 1–15 of 15 · Page 1 of 1
[Noob] Angle to Position?
I want to get a position based on my yaw angle and a range so that I get set the position to behind me, by lets say 2 metres, how would i do this? I understand this is just maths but at my level of knowledge my code just is not working, here it is please don't be mean i know its shit
Code:
local Me = player.GetByID(1)
function getMyForward() 
    local Ang = Me:GetAngles().y
    local InFrontX = math.sin(Ang) * 200
    local InFrontY = math.cos(Ang) * 200
    //return Vector( InFrontX,InFrontY,Me:GetPos().z )
	
    local Front = Vector( InFrontX + Me:GetAngles().x,InFrontY + Me:GetAngles().y,Me:GetPos().z )
	if Ang > 90 then
		Front = Vector( (InFrontX *-1)+ Me:GetAngles().x,InFrontY + Me:GetAngles().y,Me:GetPos().z )
	end
	if Ang < 0 then
		Front = Vector( InFrontX+ Me:GetAngles().x,(InFrontY *-1)+ Me:GetAngles().y,Me:GetPos().z )
	end
	if Ang < -90 then
		Front = Vector( (InFrontX *-1)+ Me:GetAngles().x,(InFrontY *-1)+ Me:GetAngles().y,Me:GetPos().z )
	end
	return Front
end 

Me:SetPos(getMyForward())
I was trying to use sin and cos to get it, but when i run it I am teleported randomly at first(it seems random) and then on a certain path that i have no idea how its getting
Quote Originally Posted by Gorzoid View Post
I want to get a position based on my yaw angle and a range so that I get set the position to behind me, by lets say 2 metres, how would i do this? I understand this is just maths but at my level of knowledge my code just is not working, here it is please don't be mean i know its shit
Code:
local Me = player.GetByID(1)
function getMyForward() 
    local Ang = Me:GetAngles().y
    local InFrontX = math.sin(Ang) * 200
    local InFrontY = math.cos(Ang) * 200
    //return Vector( InFrontX,InFrontY,Me:GetPos().z )
	
    local Front = Vector( InFrontX + Me:GetAngles().x,InFrontY + Me:GetAngles().y,Me:GetPos().z )
	if Ang > 90 then
		Front = Vector( (InFrontX *-1)+ Me:GetAngles().x,InFrontY + Me:GetAngles().y,Me:GetPos().z )
	end
	if Ang < 0 then
		Front = Vector( InFrontX+ Me:GetAngles().x,(InFrontY *-1)+ Me:GetAngles().y,Me:GetPos().z )
	end
	if Ang < -90 then
		Front = Vector( (InFrontX *-1)+ Me:GetAngles().x,(InFrontY *-1)+ Me:GetAngles().y,Me:GetPos().z )
	end
	return Front
end 

Me:SetPos(getMyForward())
I was trying to use sin and cos to get it, but when i run it I am teleported randomly at first(it seems random) and then on a certain path that i have no idea how its getting
what the fuck

if you want your forward vector do GetForward() on your player
angles are not vectors
Quote Originally Posted by Trollaux View Post
angles are not vectors
not with that attitude
Quote Originally Posted by tdsx View Post
not with that attitude
angle->vector isn't possible in the lua state, only the garry_State* copyright kingboy111
Quote Originally Posted by Trollaux View Post


angle->vector isn't possible in the lua state, only the garry_State* copyright kingboy111
wtf are you talking about
Quote Originally Posted by MeepDarknessMeep View Post
wtf are you talking about
huge code that you can't understand about casting QAngle to std::string then Vector and D3DXMatrix
whats the z of your angle
Quote Originally Posted by max1612 View Post
i use nyx for some features if somebody could link me one that doesnt automatically makes sv_cheats 1 that would be great and i dont spoof cvars i make custom ones with the same purpose
-Max1612 2015
Quote Originally Posted by Badman Tyler View Post
-Max1612 2015
oh wow gg since their isnt a documentation of the module its hard to fully understand it all *clap* *clap*
Quote Originally Posted by max1612 View Post


oh wow gg since their isnt a documentation of the module its hard to fully understand it all *clap* *clap*
no, you're just stupid and you couldn't figure out because you are a retarded skid who copy pastes basic stuff like nospread
Quote Originally Posted by max1612 View Post
oh wow gg since their isnt a documentation of the module its hard to fully understand it all *clap* *clap*
Why the fuck didn't you make your own module then? It would clearly be a lot easier to understand, wouldn't it? It would be even more easier if you didn't C+P everything you could find from HAC Booty, Sethhack and Hera.
You Fucking Suck SKid.
Big N Nasty Vectors m
hame plape
Posts 1–15 of 15 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us