CollisionHook
HEY READ THIS (MARCH 2024)
The notice below still holds. I don't personally use this extension, but contributions on GitHub are welcome. HEY READ THIS (DEC 2014) I know you probably really want to use this extension, but here's the fine print: it's now completely unsupported by myself. If you need gamedata updates you're on your own. This extension should be a last resort when you have exhausted all other options for managing collisions: m_nSolidType, m_CollisionGroup, etc This extension provides a straightforward and easy way to hook and modify collision rules between entities. You might say "but sdkhooks provides this functionality already!", and you would be partly right. However, I wasn't happy with how sdkhooks ShouldCollide works, and here's why: If you're familiar with sdkhooks, this code won't be new: PHP Code:
To solve this limitation, I wrote CollisionHook. CollisionHook provides 2 forwards to plugins, both of which can modify the collision rules of certain types of collisions. PHP Code:
PHP Code:
To modify the behavior of the collision check, simply set result to true if you wish for the entities to collide; otherwise false, and return Plugin_Handled or Plugin_Stop in the forward. If you want the game to use default collision rules, simply return Plugin_Continue in the forward. The benefits of both of these forwards is that you can strictly control which entities can collide, instead of just a specific type of entity. Installation
Source The source code is available here. Limitations / Known Issues / Notes
Thanks
|
Re: CollisionHook
This is a neat idea! I tried something like this myself a while ago and ran into a few issues with a PassServerEntityFilter detour.
Using this code for example: PHP Code:
Normally it would prevent trace weapons from hitting any player target, because the player firing is passed as pPass. So in order to differentiate player collision traces from the rest, I detoured CTraceFilterSimple::ShouldHitEntity instead which provided collisionGroup and contentsMask. Mine ended up looking like this: (unreleased because I thought it was an ugly workaround) Code:
DETOUR_DECL_MEMBER2(ShouldHitEntity, bool, IHandleEntity *, pHandleEntity, int, contentsMask) |
Re: CollisionHook
Quote:
I haven't tested CS:S so I'm not sure why that would crash, but I'll check it out and see if anything can be salvaged. Quote:
Also I'd make the assumption that most mods won't be touching CTraceFilterSimple, so the offsets to the members would likely be safe to get at. |
Re: CollisionHook
Quote:
I haven't had a chance to play around with the vphysics stuff yet but it looks pretty cool too! |
Re: CollisionHook
psychonic has been kind enough to update the extension for the linux changes that broke things a while back. You can get it here.
|
Re: CollisionHook
Wanted to make a new plugin.
No success :( PHP Code:
SM 1.4.7 & MM:S 1.9.0. |
Re: CollisionHook
Quote:
That being said, I haven't yet investigated the CS:S crashes mentioned in the previous posts. As this extension was originally designed for TF2, your mileage may vary. |
Re: CollisionHook
Quote:
PHP Code:
I'll try to find the correct signature. |
Re: CollisionHook
Does this still work? Or is there a better way to do this by now?
|
Re: CollisionHook
It works perfectly fine! There is no other way to do what this does.
|
All times are GMT -4. The time now is 11:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.