[Advice] Ragdoll, Collisions & Physics

Posted By: indiGLOW

[Advice] Ragdoll, Collisions & Physics - 10/21/09 19:15

I am in the process of prototypin a new title and would appreciate comments, suggestions and advice about how to approach the issue of character ragdoll, primarily to do with physics (actual or faked) when killing a character.

In other words how to deform the model, handle bone collisions with other models, terrains and so forth. What is the best approach to ensure lower overheads on GPU etc.

I am not looking for someone to script this for me, just some insight into pitfalls, good methodology and so on.

TIA for your input laugh
Posted By: Helghast

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 08:23

look at the code I made, i'm making it into a plugin, but havent had time for that lately xD
all those issue's have been solved, all you have to make after that is a proper ragdoll setup for each different character.

send me over an email, i'll send the files to you, it's not that hard, just took me alot of years to figure it all out from scratch tongue hahahaa

regards,
Posted By: Hummel

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 11:38

I´m also interested in these files, can I give you my e-mail too?
Posted By: indiGLOW

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 12:35

Thanks Helghast, I will drop you an email a little later if that's ok?

I've spent a fair amount of time myself working with bones, including rigging up a head to turn and follow players, moving eyes at the correct amount etc. So I am pretty happy that I can write it ,although it sounds like your script might save me some time there, much appreicated.

I am working with 3D Studio max and Biped, so all my bones are named and easily referenced so that shouldn't be to hard to setup.

My questions are really about performance, for example, do you need to run a lot of tracing to get the final rest position or does the bones system support some kind of physics collision? What are the overheads if that is true?

The title I am working on at the moment can have around 30 active agents including up to four players over network / internet, so it would be really good to have an idea how to manage this.

I suspect that ragdoll during death will be client side only, as the final resting position of the model will not be critical, unless they interact with other entities (something I am not planning on at present).

Thanks for sharing, please let me know if you (or anyone else) has any more advice.
Posted By: Helghast

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 13:19

Originally Posted By: indiGLOW
Thanks Helghast, I will drop you an email a little later if that's ok?


Sure wink

Originally Posted By: indiGLOW

I've spent a fair amount of time myself working with bones, including rigging up a head to turn and follow players, moving eyes at the correct amount etc. So I am pretty happy that I can write it ,although it sounds like your script might save me some time there, much appreicated.


Good that definatly helps in setting it up... however it's mroe about setting up the ragdoll physics objects properly.

Originally Posted By: indiGLOW

I am working with 3D Studio max and Biped, so all my bones are named and easily referenced so that shouldn't be to hard to setup.

My questions are really about performance, for example, do you need to run a lot of tracing to get the final rest position or does the bones system support some kind of physics collision? What are the overheads if that is true?


It's physics impacts using ODE (I guess it can be updated for PXent or Newton just as easy), which with alot of collisions does tend to be a bit slow

Originally Posted By: indiGLOW

The title I am working on at the moment can have around 30 active agents including up to four players over network / internet, so it would be really good to have an idea how to manage this.

I suspect that ragdoll during death will be client side only, as the final resting position of the model will not be critical, unless they interact with other entities (something I am not planning on at present).


30 active ragdolls might make a pc go slow... you'll have to pull out some tricks (updating bones only when a certain degree was rotated, and after a certain amount of ragdolls disable earlier ones, etc etc)...

Originally Posted By: indiGLOW

Thanks for sharing, please let me know if you (or anyone else) has any more advice.


it's alot of setting things up properly, but when it's done and working it's definatly worth it, good luck!
you can drop me a line whenever you need some advice.

kind regards,
Posted By: darkinferno

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 13:28

having up to 30 ragdolls is doable but also remember that, not because 30 guys die means that all their ragdolls are being moved at the same time, some may have died before and stopped moving, freeing up resources
Posted By: indiGLOW

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 13:56

@darkinferno: Getting a balance for performance shouldn't be too hard, also I guess not all deaths will require ragdoll, in some cases complete vapourization wont leave much to ragdoll laugh

Of course having a cutoff point so that once the bodies are settled they do not collide any more will also help.

@Helghast: I've dropped you a PM with my email address laugh
Posted By: indiGLOW

Re: [Advice] Ragdoll, Collisions & Physics - 10/22/09 21:54

@Helghast: Would be really helpful if you could forward me a link, or email me your code example, just so I can get a handle on the way you have approached it.

Thanks in Advance
Posted By: rayp

Re: [Advice] Ragdoll, Collisions & Physics - 10/23/09 04:56

Ive tryed the ragdoll from helghast a year ago. Its working great. But i never managed to remove the ragdoll bodys (after some time). frown
Posted By: indiGLOW

Re: [Advice] Ragdoll, Collisions & Physics - 10/24/09 14:19

I am trying to get my head around this and it seems the more I experiment the more confused I become.

The one conclusion I've come to is that whilst it would be a nice little feature, including Rag Doll at this stage is not vital and as I improve the rigging of my game characters and with the export pipeline through .fbx working very well for me I am sure that I can come back at a later stage and add it.

Maybe Helghast will have some kind of plugin kicked out by then too.

Either way its certainly given me food for thought...

Cheers all
Posted By: Helghast

Re: [Advice] Ragdoll, Collisions & Physics - 10/25/09 19:47

im sorry, I am gonna send the files out somewhere next week to anyone that PM'd me...
Hadda revamp the header files (I believe evilSOB made them for me someday... gotta find that out for credit purposes too) to make it all properly work as a simple plugin.

kind regards and thanks for the waiting.
Posted By: xXxGuitar511

Re: [Advice] Ragdoll, Collisions & Physics - 10/26/09 19:53

Simple steps:

1) When your player dies, create a basic skeleton of simple blocks for the bones. I don't remember the names (been a while), but their are functions for reading the position and angles of the current animation. Start with the chest block, being at the players xyz position and having the same angles as well; This will be your base for the ragdoll pieces. Create the arms and legs afterwards. Once finished, you should have a simple skeleton for your model. Make sure your character stores a pointer to each model you create, so you can look them up later.

2) Create hinges (not ball joints) between your bones. You can only read angles from hinges, not ball joints. Activate physics for all the bones. At this point, when your character dies, it should have a skeleton created that matches it's animated position, which now has proper ragdoll physics.

3) Now that your skeleton is moving, use those pointers to reference back to the skeleton. Set your models position and orientation to the base (chest) models position. There is a physics function for checking the angle of physics constraints, use this and some tricky angle rotations to rotate your models bones to match the skeleton. Make sure you reset the models animation before doing the rotations.

The skeleton models you use for physics will have to be "tuned" to match each area of the model. Also make sure you set their invisible flags of course.

Helghast and I worked on this code together, so our code is very similar. Read through it, and match it up to whats described above, and you should be able to get it working and fit to your needs.
Posted By: Blackchuck

Re: [Advice] Ragdoll, Collisions & Physics - 12/16/09 16:09

or look here;

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=302098&page=1
© 2024 lite-C Forums