Raised This Month: $ Target: $400
 0% 

trace_line to the ground


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-15-2009 , 03:57   Re: trace_line to the ground
Reply With Quote #1

Not much to show. I have defined two points that create a large box in a map. Within this box, I wish to spawn things 50 units above the ground. Here's how I'm getting my points (this works):

PHP Code:
FindPointAboveGround(Float:Origin[3])
{
    static 
Float:Start[3]
    static 
Float:End[3]
    
    do
    {
        
Start[0]=random_float(X1,X2)
        
Start[1]=random_float(Y1,Y2)
        
Start[2]=random_float(Z1,Z2)
        
        
End[0]=Start[0]
        
End[1]=Start[1]
        
End[2]=(Start[2]-5000.0)
        
        
trace_line(0,Start,End,Origin)
    }while(
Origin[2]<-5000.0)
    
    
Origin[2]+=50.0

But I don't know if this is necessarily a "good way" to do it, by assigning an arbitrarily huge number to trace down to, or if there's another way to make it just trace until it hits the ground.

The Origin[2]<-5000.0 condition is what I check against to see if my random start point was created inside of a wall, in which case it traces through the map to the huge number below, and I do it again.
__________________
Bad_Bud is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode