hey, this is what i want:
[IMG]http://img39.imageshack.us/img39/193/explaink.png[/IMG]
I tried normalising the prop and destination vector, but in one site i fount that you can't find out the angle if it aint: |v1|=|v2|=1. My destination normal is always something around 2:
(-0.004, 0.084, 1.000 and varies)
[IMG]http://img39.imageshack.us/f/explaink.png/[/IMG]
If you want an angle object out of it,
[lua]( destination - prop:GetPos() ):Angle()[/lua]
To find the angle between 2 vectors:
[code]math.Rad2Deg( math.acos( vec1:Normalize():Dot( vec2:Normalize() ) ) )[/code]
In this case, your 2 vectors are:
[code]vec1 = destination - prop:GetPos()
vec2 = prop:Up()[/code]
It doesn't matter which way round they are.
[quote=thomasfn][code]math.Rad2Deg[/code][/quote]
Why does anybody use Rad2Deg or Deg2Rad? math.rad, math.deg already exist natively.
[QUOTE=Kogitsune;22982505]Why does anybody use Rad2Deg or Deg2Rad? math.rad, math.deg already exist natively.[/QUOTE]
I thought they were just aliases of each other. Like, math.Rad2Deg = math.deg.
They aren't.
[lua]/*---------------------------------------------------------
Name: Deg2Rad( in )
Desc: Convert degrees to radians
---------------------------------------------------------*/
function math.Deg2Rad( deg )
return deg * ( math.pi / 180 )
end
/*---------------------------------------------------------
Name: Rad2Deg( in )
Desc: Convert radians to degrees
---------------------------------------------------------*/
function math.Rad2Deg( rad )
return rad * ( 180 / math.pi )
end[/lua]
[QUOTE=Kogitsune;22983402]They aren't.
[lua]/*---------------------------------------------------------
Name: Deg2Rad( in )
Desc: Convert degrees to radians
---------------------------------------------------------*/
function math.Deg2Rad( deg )
return deg * ( math.pi / 180 )
end
/*---------------------------------------------------------
Name: Rad2Deg( in )
Desc: Convert radians to degrees
---------------------------------------------------------*/
function math.Rad2Deg( rad )
return rad * ( 180 / math.pi )
end[/lua][/QUOTE]
Oh, didn't know that. Why did Garry add these in the first place then :confused:
From what I recall, back in the day the gold members helped make the sandbox gamemode originally ( I could be wrong and probably am ). It stands to reason this came from one of their helper libraries if this is true.
[QUOTE=Kogitsune;22983558]From what I recall, back in the day the gold members helped make the sandbox gamemode originally ( I could be wrong and probably am ). It stands to reason this came from one of their helper libraries if this is true.[/QUOTE]
Ehh ok well, time to add more stuff to my util library:
[code]math.Rad2Deg = math.deg
math.Deg2Rad = math.rad[/code]
[QUOTE=Kogitsune;22983558]From what I recall, back in the day the gold members helped make the sandbox gamemode originally ( I could be wrong and probably am ). It stands to reason this came from one of their helper libraries if this is true.[/QUOTE]
People did help out, whether or not it was Gold Members, I'm unsure.
Sorry, you need to Log In to post a reply to this thread.