ladders and angles and beams
Posted: Wed Aug 31, 2005 2:11 pm
Hey 
my first post here and allready asking for help :s
some of you may have read this post at tmt if so i apolagise - I just know there is more inteligence here
right:
I am creating a global ladder spawning script (for server\side ladders)
everything works fine...
however I was unable to work out user definable angles.
due to the construction of the ladders (multiple func_beams) I cant just apply an angle.
however I am sure the coords can be parse/worked out from the angle.
I hjave done this allready but I have got lost with all the figures.
basicly I am trying to work out where to place the second main beam acording to a user set angle:
the figure (45) is the distance between the mainbeams
thanks for any help
my first post here and allready asking for help :s
some of you may have read this post at tmt if so i apolagise - I just know there is more inteligence here
right:
I am creating a global ladder spawning script (for server\side ladders)
everything works fine...
however I was unable to work out user definable angles.
due to the construction of the ladders (multiple func_beams) I cant just apply an angle.
however I am sure the coords can be parse/worked out from the angle.
I hjave done this allready but I have got lost with all the figures.
basicly I am trying to work out where to place the second main beam acording to a user set angle:
the figure (45) is the distance between the mainbeams
Code: Select all
if(local.angle > 180)
{
local.angle = ( local.angle - 360 )
}
local.case1 = (local.angle >= 0 && local.angle <= 90)
local.case2 = (local.angle > 90 && local.angle <= 180)
local.case3 = (local.angle < 0 && local.angle >= -90)
local.case4 = (local.angle < -90 && local.angle >= -180)
if(local.case1)
{
local.xcoord = (local.angle * 0.5)
local.ycoord = ((local.angle - 90) * 0.5)
}
if(local.case2)
{
local.xcoord = (45 - ((local.angle - 90) * 0.5))
local.ycoord = ((local.angle - 90) * 0.5)
}
if(local.case3)
{
local.xcoord = (local.angle * 0.5)
local.ycoord = ((local.angle - -90) * 0.5)
}
if(local.case4)
{
local.xcoord = ( -45 - ((local.angle - -90) * 0.5))
local.ycoord = ((local.angle - -90) * 0.5)
local.side = spawn func_beam origin ($("mainbeam_" + local.number).origin + ( local.xcoord local.ycoord 0 )) endpoint ($("mainbeam_" + local.number).origin + ( local.xcoord local.ycoord local.hieght )) targetname (mainbeam2_" + local.number)
}thanks for any help