Raised This Month: $51 Target: $400
 12% 

Surface big enough check (solved)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-04-2010 , 17:24   Surface big enough check (solved)
Reply With Quote #1

Is there a way to check the surface if it's big enough to fit a model on it ? I don't want it to be obstructed by anything, in front (like a ladder) or behind (like placed on a corner and it's empty space right next to it)

Also, I don't really know how to get a wall's angle, what's the simpliest way to do that ? I searched plugins but there are alot of different calculations using functions I don't even understand what they do O.o

And for something to autoadjust the model to the edge of the wall of you aim too far from the zone that could in fact fit in can be too much for this engine ?
__________________
Hunter-Digital is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-06-2010 , 03:51   Re: Surface big enough check
Reply With Quote #2

Aw come on, any ideea ?
__________________
Hunter-Digital is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 09-06-2010 , 05:29   Re: Surface big enough check
Reply With Quote #3

I think you can place the model and then search for Solids in some low range :-?
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-06-2010 , 05:46   Re: Surface big enough check
Reply With Quote #4

What do you even mean by "search for solids" ? I want to check a wall... that's just a human definition but in game, the world is just one big chunk of solid stuff...

I need something to check, for example, if a solid is touching something else with all corners... like a poster on a wall, you can only place as long as there is a wall, if you go past a corner of the wall, the other corners of the poster would be in mid-air...

I already found a method to check for obstructions in front, but I need to check behind it, the wall, if it's all there, not empty spaces different angles of planes.
__________________
Hunter-Digital is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-06-2010 , 06:19   Re: Surface big enough check
Reply With Quote #5

Here is a stock that might help you. I used in my block wallhack plugin to determine the place where player walks on a surface. Please ask questions about the lines that you do not understand.

The function basically gets the lowes vector distance to the surface that the player is lying on.
And for ladders the way to determine is with TRACE_HULL. For traceHull I suggest checking teleport smoke grenade by ven.
PHP Code:
#define FOOTSTEP_DIST        14.0
#define SND_ZVELOCITY        0.0
#define SND_MOVEVELOCITY    136.0
#define OFFSET_MINTRACE        60.0
#define SND_MULCONST        0.1

stock getFootStepCoords(idFloat:fstart[3], Float:fend[3])
{
    new 
Float:start[5][3], Float:end[5][3], Float:diff[5][3], Float:angle[3], Float:fwd[3], Float:right[3], ent[5], grndentbool:halftests false
    
    entity_get_vector
(idEV_VEC_v_angleangle)
    
    
angle_vector(angleANGLEVECTOR_FORWARDfwd)
    
fwd[2] = 0.0
    angle_vector
(angleANGLEVECTOR_RIGHTright)
    
    if (
xs_vec_len(fwd) != 0.0)
        
xs_vec_mul_scalar(fwdFOOTSTEP_DIST/xs_vec_len(fwd), fwd)
    else
        
halftests true
    
    xs_vec_mul_scalar
(rightFOOTSTEP_DIST/xs_vec_len(right), right)
    
    
// Get Normal start and end origins
    
entity_get_vector(idEV_VEC_originstart[0])
    
end[0] = start[0]
    
end[0][2] -= OFFSET_MINTRACE
    
    
if (halftests)
    {
        
xs_vec_add(start[0], rightstart[1])
        
xs_vec_sub(start[0], rightstart[2])
        
        
grndent entity_get_edict(idEV_ENT_groundentity)
        
        for (new 
i=0;i<3;i++)
        {
            
ent[i] = trace_line(-1start[i], end[i], diff[i])
            
            if (
ent[i] != grndent)
            {
                
diff[i] = end[i]
            }
            
            
xs_vec_sub(diff[i], start[i], diff[i])
        }
        
        new 
minindex 0Float:minlenFloat:curlen
        minlen 
xs_vec_len(diff[0])
        
        for (new 
i=1;i<3;i++)
        {
            
curlen xs_vec_len(diff[i])
            
            if (
minlen curlen)
            {
                
minlen curlen
                minindex 
i
            
}
        }
        
        
fstart start[minindex]
        
fend end[minindex]
        
        return 
ent[minindex]
    }
    
    
xs_vec_add(start[0], fwdstart[1])
    
xs_vec_add(start[1], rightstart[1])
    
    
xs_vec_add(start[0], fwdstart[2])
    
xs_vec_sub(start[2], rightstart[2])
    
    
xs_vec_sub(start[0], fwdstart[3])
    
xs_vec_add(start[3], rightstart[3])
    
    
xs_vec_sub(start[0], fwdstart[4])
    
xs_vec_sub(start[4], rightstart[4])
    
    
xs_vec_add(end[0], fwdend[1])
    
xs_vec_add(end[1], rightend[1])
    
    
xs_vec_add(end[0], fwdend[2])
    
xs_vec_sub(end[2], rightend[2])
    
    
xs_vec_sub(end[0], fwdend[3])
    
xs_vec_add(end[3], rightend[3])
    
    
xs_vec_sub(end[0], fwdend[4])
    
xs_vec_sub(end[4], rightend[4])
    
    
grndent entity_get_edict(idEV_ENT_groundentity)
    
    for (new 
i=0;i<5;i++)
    {
        
ent[i] = trace_line(-1start[i], end[i], diff[i])
        
        if (
ent[i] != grndent)
        {
            
diff[i] = end[i]
        }
        
        
xs_vec_sub(diff[i], start[i], diff[i])
    }
    
    new 
minindex 0Float:minlenFloat:curlen
    minlen 
xs_vec_len(diff[0])
    
    for (new 
i=1;i<5;i++)
    {
        
curlen xs_vec_len(diff[i])
        
        if (
minlen curlen)
        {
            
minlen curlen
            minindex 
i
        
}
    }
    
    
fstart start[minindex]
    
fend end[minindex]
    
    return 
ent[minindex]

__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-07-2010 , 10:52   Re: Surface big enough check
Reply With Quote #6

Well, now I'm just confused, I don't really get anything from that...

I noticed that "FL_PARTIALGROUND" specifies "Not all corners are valid", how can a solid validate all corners while touching something ... like "FL_ONGROUND" but for walls too ?
Aaaand in baby steps please :}
__________________
Hunter-Digital is offline
DaxProxy
Senior Member
Join Date: Sep 2007
Old 09-07-2010 , 11:24   Re: Surface big enough check
Reply With Quote #7

Oh i'll help you out in a min.
Edit:
http://apollorp.org/viewtopic.php?f=9&t=486
It's pretty straight forward and easy to underastand how the space check is done there.
__________________

Want ApolloRP for Counter-Strike? Show your support: http://forums.alliedmods.net/showthr...39#post1264739
DaxProxy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-07-2010 , 12:21   Re: Surface big enough check
Reply With Quote #8

It would be more useful to me and anyone else searching for same thing if you attached that file, I don't have an account there.
__________________
Hunter-Digital is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-09-2010 , 02:30   Re: Surface big enough check
Reply With Quote #9

Well, I think I'm gonna do a bunch of trace lines in the corners then.

Another problem here tough, the object I'm using rotates in all directions and it's quite hard for me to calculate the points :/ any help ? :}

Something like this:
[IMG]http://img230.**************/img230/6963/sketch.gif[/IMG]
Those red points should be like 2 units behind the black object, and I'll check them with trace lines, if any of it don't hit anything, it's not a valid surface.
__________________
Hunter-Digital is offline
DaxProxy
Senior Member
Join Date: Sep 2007
Old 09-09-2010 , 03:51   Re: Surface big enough check
Reply With Quote #10

I don't think it's a good idea...you really should waste your 5 minutes and register to ApolloRP forums as i dont have premission to share Hawk's code here...
__________________

Want ApolloRP for Counter-Strike? Show your support: http://forums.alliedmods.net/showthr...39#post1264739
DaxProxy 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 04:36.


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