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

How to detect if a player is touching a wall


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
01101101
BANNED
Join Date: Nov 2009
Location: 9`su 09`n0n7e`r0f76a
Old 12-22-2009 , 04:56   How to detect if a player is touching a wall
Reply With Quote #1

Title says all.
01101101 is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 12-22-2009 , 05:44   Re: How to detect if a player is touching a wall
Reply With Quote #2

touching with knife ? or shot ? or just the use key ?
platzpatrone is offline
01101101
BANNED
Join Date: Nov 2009
Location: 9`su 09`n0n7e`r0f76a
Old 12-22-2009 , 06:07   Re: How to detect if a player is touching a wall
Reply With Quote #3

If the player entity (the body) is colliding with the wall.
01101101 is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 12-22-2009 , 08:55   Re: How to detect if a player is touching a wall
Reply With Quote #4

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.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
bibu
Veteran Member
Join Date: Sep 2010
Old 04-22-2011 , 20:19   Re: How to detect if a player is touching a wall
Reply With Quote #5

Quote:
Originally Posted by joropito View Post
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 is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-10-2011 , 13:09   Re: How to detect if a player is touching a wall
Reply With Quote #6

bump
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-10-2011 , 14:27   Re: How to detect if a player is touching a wall
Reply With Quote #7

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.

Last edited by SnoW; 07-10-2011 at 14:30.
SnoW is offline
Send a message via MSN to SnoW
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 07-10-2011 , 15:39   Re: How to detect if a player is touching a wall
Reply With Quote #8

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.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-10-2011 , 15:56   Re: How to detect if a player is touching a wall
Reply With Quote #9

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.
SnoW is offline
Send a message via MSN to SnoW
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-10-2011 , 17:23   Re: How to detect if a player is touching a wall
Reply With Quote #10

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         }     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 13:39.


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