AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to detect when player standing on uneven surface? (https://forums.alliedmods.net/showthread.php?t=203967)

hh2 12-25-2012 16:35

How to detect when player standing on uneven surface?
 
1 Attachment(s)
Hello.
Is there a way to detect if player standing on uneven surface like a ramp on de_nuke or ramp on de_dust2 on long?
In attachment its example of this places marked as "red X".
Is it possible?

Thanks for any help.

hh2 12-27-2012 09:11

Re: How to detect when player standing on uneven surface?
 
Bump.

Sylwester 12-27-2012 10:44

Re: How to detect when player standing on uneven surface?
 
don't bump until at least 2 weeks have passed since last post

this should work in most cases (it may fail if player is standing on the edge):
PHP Code:

public function(id){
    new 
trFloat:start[3], Float:dest[3]
    
pev(idpev_originstart)
    
dest[0] = start[0]
    
dest[1] = start[1]
    
dest[2] = start[2] - 100.0
    engfunc
(EngFunc_TraceLinestartdestIGNORE_MONSTERSidtr)
    
get_tr2(trTR_vecPlaneNormaldest)
    if(
xs_vec_dot(Float:{0.0,0.0,1.0}, dest) != 1.0){
        
//uneven surface
    
}



hh2 12-27-2012 11:50

Re: How to detect when player standing on uneven surface?
 
Works correctly.
Thanks for help Sylwester.


All times are GMT -4. The time now is 13:40.

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