GMod/Blender - Moving a collision model relative to an animated part?
5 replies, posted
Hey Facepunch
I'm wondering if anyone could point me in the right direction of what to use when wanting a specific part on a object to have its own collision model. What i mean by this is, if for an example i have a box, and that box has a door what can animate ( open and close ) i want itto that box door has its own collision model.
Now, from what i've read on the valve wiki, it seems I may have to use this $collisionjoints could anyone please confirm if this is the correct thing i should be using. Just to be clear, I'd like a physics model to follow a specific part of a model when it's moving.
Your help will be greatly appreciated, thanks.
Well... why don‘t you try it out?
Yeah, I've tried it but i think i've been using it in a wrong way. I can pretty much do everything in blender, not on an expert level, but enough to understand. The only thing whats preventing me to move up is this, grrrrrrrrrrrrrr
The problem is that, as far as I am aware of, $collisionjoints does not care in the slightest for whether you have an animation manipulating the moving parts or not.
However, it will definitely follow the door properly when "natural force" is applied to it if you weight-paint a part of the collision mesh to the bone responsible for moving the door without any middle ground in-between.
This is more or less the exact same setup as ragdolls are using with multiple parts as the limbs, which means that you have to sacrifice the prop-label for a ragdoll-label on your box if you want to do it this way. A prop by definition would not fall under this category if it was possible to open the door manually by applying force on it, like pulling it open with the Physgun beam.
But, if you are considering making this an entity of some sort, like a "click-to-open"-entity of some sort, I would instead convoluted-ly suggest, if you are greatly interested in getting this idea to work, to have animations that show the door moving between closed and open states, but you would then utilize a bit of lua-code to replace the entity with a different prop resembling itself that has the door open with the collision model set to account for this. And you would do this as the animation is just finished transfering the door from one state to the other. As seamless as possible.
Mind you, this does not account for physics changing as the door opens or closes, but instead would update when the door has finished opening or closing.
I've meddled a bit with this on my own and it's actually been moderately successful, albeit a bit uncertain if this is actually the best way to do it, neither if it's performance inducing or not.
I'd love for there to be an option to switch physics models around if you have multiple but I am not aware of that being an option, unfortunately, which is why I've personally resorted to the more convoluted solution aforementioned above.
Thanks for your reply @Mailer , it does seems i've made some progress by simply putting this in my qc.
$collisionjoints "phys.smd"
{
$concaveperjoint
}
This is what it looked like in HLMV
https://files.facepunch.com/forum/upload/111140/a86c6474-9fc1-49de-a3f2-72fcfb570a4d/CSAFE_TEST_8.mp4
From the video you can see they're nicely joined together, and are bonded.
If you click here you can see it as a model in-game
With no surprise, i knew tey'd be disconnect but i assumed if i made them an actual sENT they'd join, and they did! But...look what happens in the video, i'm trying to view the collision model but doing vcollide_wireframe 1 and from what you'll see in the video, the collision model just isn't even appearing, it's however using some collsion model, but some sorta generated one?
The only issue is the collision model doesn't seem to be there when spawned as a entity.
my pc is poor, so it'll run the file below and pc through ur gmod.
csafe_coll_1.dem
you know we won't be able to see the demo file since we don't have your map neither your model right?
Sorry, you need to Log In to post a reply to this thread.