ladders and angles and beams

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
sorridstroker
Lance Corporal
Posts: 22
Joined: Wed Aug 31, 2005 2:05 pm

ladders and angles and beams

Post by sorridstroker »

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

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
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I believe the post on TMT solved the problem? If not, there's always someone here to help :wink:
Image
sorridstroker
Lance Corporal
Posts: 22
Joined: Wed Aug 31, 2005 2:05 pm

Post by sorridstroker »

yhea thanks man :)

now if only I could understand the maths :s

think im going to try and write my own equation cuz I look at yours and my eyes go all cross eyed and my brain overheats lol.

hehe wish I concentratedin maths class now :(
Post Reply