Facepunch / garrysmod-requests

Feature requests for Garry's Mod
83 stars 24 forks source link

Add the ability for mesh-based collision #1523

Open Roachdaripper opened 4 years ago

Roachdaripper commented 4 years ago

So, when you fight a Strider in HL2, you may notice that you're able to run underneath it and the only thing that you can collide with are its legs (and of course the rest of its body should you noclip up there) The rest of the NPCs, and all lua-based NPCs (and particularly nextbots which is the reason I made this feature request) all use a bounding box based collision system which covers the entire model and allows no room for doing things like running around/under legs, this is a particular problem with larger models since for their bbox to cover their entire model they end up taking up an obnoxious amount of space that makes it difficult for their fights to be enjoyable.

tl;dr would it be possible to add mesh-based collision to scripted NPCs / Nextbots in place of a bbox-based collision system, like the hl2 strider has

robotboy655 commented 4 years ago

Have you tried the obvious?

https://wiki.facepunch.com/gmod/Entity:SetSolid

Roachdaripper commented 4 years ago

Have you tried the obvious?

https://wiki.facepunch.com/gmod/Entity:SetSolid

yes, it doesn't work EDIT: to clarify, the collisions work but it breaks locomotion on nextbots for some reason

Jvs34 commented 4 years ago

The way striders work I'm pretty sure is that they have no collisions by default.

The NPC attaches special entities ( one per physics bone on their default ragdoll ) that are marked as shadow controllers that are impervious to physics but can still push others around.

If I recall correctly every NPC (except nextbots, they're not NPCs) can have that support with a hammer input and it might've been used a couple of times in the HL2 campaign to make NPCs push shit off tables.

I might be able to coax an example on how to do something like that in Lua for nextbots when I have time, I do have something I made years ago but it uses the hitbox bounds for the physics mesh instead of the ragdoll mesh so keep that in mind (and also the example uses a player and the code could definitely be improved).

Roachdaripper commented 4 years ago

yeah its kinda annoying, another thing i really wanted was a kind of hitbox-based jigglebone thing but i'm almost positive that something like this would require massive engine modifications since jigglebones atm cannot collide with the rest of the model

thegrb93 commented 4 years ago

Don't expect devs to add new engine features. This is a ~20 year old engine and its not even their engine.

Roachdaripper commented 4 years ago

Don't expect devs to add new engine features. This is a ~20 year old engine and its not even their engine.

that's why its a suggestion not an expectation :P

thegrb93 commented 4 years ago

Both of them can already be done with lua and clever tricks like what Jvs34 said, so that's your only bet.

Roachdaripper commented 4 years ago

yeah the hitbox thing is doable but the jigglebones thing isn't and if it is i have no idea where to even begin with something like that

thegrb93 commented 4 years ago

If you can get a physical control point to follow the bone's linear and angular velocity, then you can constrain other physics objects to that.

Roachdaripper commented 4 years ago

If you can get a physical control point to follow the bone's linear and angular velocity, then you can constrain other physics objects to that.

so you're suggesting manually making jigglebones with lua right? what i meant was for QC jigglebones to have this collision feature

thegrb93 commented 4 years ago

I know what you're saying. I'm saying the solution has to be lua because there's never been a new qc param added specifically for garrysmod and there may never will be.

Roachdaripper commented 4 years ago

i disagree, 4 way blending was added for gmod and it isn't a feature of regular source, though it was also added to black mesa

Roachdaripper commented 4 years ago

just bumping this, i tried jvs's solution, and it works for collision, but trying to use constraints with it to simulate jigglebones causes the game to crash