Facepunch / garrysmod-requests

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

Entity:RemoveBone( number BoneID ) #676

Open kklouzal opened 8 years ago

kklouzal commented 8 years ago

It should be possible to replicate such a function and allow us to remove bones from models.

Any child bones would have to go as well but this isn't an issue.

Any verticies and indicies grouped to this bone would be removed also.

This would open the door for scripts that allow for arms and legs to be 'blown off' and launched across the map. Armor/Clothing systems that enable you to 'take' only the pieces you want from one model and create a new entity from it to be attached to something else.

In conjunction with things like Entity:FollowBone and EF_BONEMERGE scripts could take a bunch of different car models or anything that share bone names to 'Frankenstein' together a brand new looking entity.

Please consider this, thank you for your time.

NanoAi commented 8 years ago

You can actually partially do this but in a kind of hacky way. I do agree we need a way to do this without having to hack a way around it, maybe add a way to actually slice rag-dolls into parts?

robotboy655 commented 8 years ago

I don't think this is actually possible.

NanoAi commented 8 years ago

https://pbs.twimg.com/media/BruMGzcIQAAzYlB.jpg But what about this... https://youtu.be/nwZ3-fxq1gE?t=40

kklouzal commented 8 years ago

From a lua standpoint no this is currently impossible. Each model once loaded into the game is organized into some sort of data structure/class that keeps track of the models verticies and indicies.

Remove the verticies and indicies from the data structure which is are tied to the bones we want to get rid of.

Definitely not the correct solution nor have I directly worked with the source engine specifically, but not impossible.

@LuaTenshi in your video they are most likely scaling the head bone to 0 which effectively hides the bone and all verticies attached however they are still there and probably still being rendered. Much more efficient if we could literally remove the bone and have all the attached verticies go with it

https://facepunch.com/showthread.php?t=1510101&p=49912924

robotboy655 commented 8 years ago

Well, logically it's obviously should be possible, but with how Source engine is set up and everything, it'd be near impossible to do, and is definitely not worth the time and work spent for such a niche feature.

Kefta commented 8 years ago

@robotboy655 how does the engine currently handle it?

thegrb93 commented 8 years ago

@Kefta It doesn't. L4d2 engine does though.

thegrb93 commented 8 years ago

The gibsplat mod sets the model scale of removed limbs' bones to 0, sets the bone's masses to 1, and creates individually modeled custom ragdoll pieces.

NanoAi commented 8 years ago

@thegrb93 So based on what your saying (with the L4D2 engine) we will pretty much have to wait for a "Garrysmod 2" to come out, to get this working?

I'm sure it could be done with some sort of hacky dll, many people have dug into the source engines code before to manipulate stuff to their liking.

thegrb93 commented 8 years ago

I guess maybe a new entity (prop_ragdoll_editable) could be added which allows modifications of its bones, but you would need the skill and time to do it.

SuperHighVoltage commented 8 years ago

L4D2 doesn't remove bones, it overlays a texture that makes the selected area invisible. That shader is more of what we want

robotboy655 commented 8 years ago

So you want stencils?

Acecool commented 8 years ago

It is possible to read / parse bsp / map files using Lua, and to render them... I'd have to image the same is possible for models ( maybe not ) where the model can be rewritten to exclude the limbs then saved as a data .txt file then loaded in as a new model....

Another way would be the tool that allows you to cut props / models with the physics model... Look at the code to see how it is done and replicate it for player models... I've been wanting to try it out but have been working on other things.