AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to detect if a player is touching a wall (https://forums.alliedmods.net/showthread.php?t=112915)

01101101 12-22-2009 04:56

How to detect if a player is touching a wall
 
Title says all.

platzpatrone 12-22-2009 05:44

Re: How to detect if a player is touching a wall
 
touching with knife ? or shot ? or just the use key ? :oops:

01101101 12-22-2009 06:07

Re: How to detect if a player is touching a wall
 
If the player entity (the body) is colliding with the wall.

joropito 12-22-2009 08:55

Re: How to detect if a player is touching a wall
 
For wall touch when you're not on ground, you can use register_touch and check for FL_ONGROUND on player.

If it's on ground, you can even make some tracelines all along the vertical of bound box...

Afaik you can't check if it's touching a real wall or any object in worldspawn because you can't differentiate it.

bibu 04-22-2011 20:19

Re: How to detect if a player is touching a wall
 
Quote:

Originally Posted by joropito (Post 1026801)
For wall touch when you're not on ground, you can use register_touch and check for FL_ONGROUND on player.

If it's on ground, you can even make some tracelines all along the vertical of bound box...

bump for this. Could anyone help me with this?

bibu 07-10-2011 13:09

Re: How to detect if a player is touching a wall
 
bump

SnoW 07-10-2011 14:27

Re: How to detect if a player is touching a wall
 
Code:
register_touch( "player", "worldspawn", "Touch" ); register_touch( "player", "func_wall", "Touch" ); register_touch( "player", "func_breakable", "Touch" ); public Touch( Id, Ent ) {      if( ~get_entity_flags( Id ) & FL_ONGROUND )           //Player touching wall      else           //Player on ground, might be touching wall }
For futher go with Joropito's ideas.

meTaLiCroSS 07-10-2011 15:39

Re: How to detect if a player is touching a wall
 
I've been trying to detect if a player is touching a wall, time ago, and I didn't found nothing :/ this is helpful, totally.

SnoW 07-10-2011 15:56

Re: How to detect if a player is touching a wall
 
On the ground touching occasion I do not know better way than joropito's suggestion of tracing all the sides, which I do not have time to write either.

Exolent[jNr] 07-10-2011 17:23

Re: How to detect if a player is touching a wall
 
Here is for the tracing around bounds check:

Code:
public plugin_init() {     RegisterHam(Ham_Touch, "player", "FwdPlayerTouch") } public FwdPlayerTouch(id, ent) {     new Float:origin[3]     entity_get_vector(id, EV_VEC_origin, origin)         new hull = (get_entity_flags(id) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN         new Float:temp_origin[3]     for(new i = 0; i < 4; i++)     {         temp_origin = origin         temp_origin[i / 2] += ((i % 2) ? -1.0 : 1.0)                 if(trace_hull(temp_origin, hull, id, 1))         {             // touching wall             break         }     } }


All times are GMT -4. The time now is 16:32.

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