Enabling physics on bones?

Posted By: Vision

Enabling physics on bones? - 06/01/07 22:24

I am wondering if it is possible to enable physics on a bone or series of bones, from my understanding of the physics can be enabled on one entity, but not its underlying bones structure?

If this is possible, an example of how to go about doing this would be greatly appreciated.
Posted By: HeelX

Re: Enabling physics on bones? - 06/02/07 11:26

Yes, you can.

As you said, you "normally" enable ONE entity to be controlled as physics entity. Now, if you want to enable a bone skeleton, you have to re-create the bone structure first. That means, you translate the bone setup into a hinged physics structure. You create first all bone nodes (as boxes or spheres) at the bone positions. Then you connect them one by one as it is defined in your characters bone-skeleton layout.

After recreating the skeleton, you have to disable the whole physics skeleton first. When you want to enable bone physics on your character you have to move the bone simulation first into the appropriate position (circumstanced by character position and animation frame). After posing, you enable physics and disable the whole (scripted) character control (which would affect movement and animation, etc.). While the physics skeleton is being "active", you would run a additional routine that checks the physics skeleton and its node positions. In each frame you have to reset the model and move each bone (beginning at the base-bone, because all others are affected) to the related physics node entity of the physics skeleton.

The whole thing is relatively easy compared to the bone movement and rotation, because bones are driving me mad - remember that each bone (no matter which position it has and which rotation has a 0,0,0 rotation and a 0,0,0 position when resetted. This is absolutely weird and makes everything more complex as it has to be.

I hope you got the idea.
Posted By: PHeMoX

Re: Enabling physics on bones? - 06/03/07 01:04

Quote:


The whole thing is relatively easy compared to the bone movement and rotation, because bones are driving me mad - remember that each bone (no matter which position it has and which rotation has a 0,0,0 rotation and a 0,0,0 position when resetted. This is absolutely weird and makes everything more complex as it has to be.




It's easier when you work with the kind of animation cycle the character goes through, instead of trying to match everything to the exact correct angles.

I don't know in which cases you use the physics on bones, but usually you won't even notice a slightly wrong 'morph' into physics entities when the player get's blown up and the body moves accordingly into the air or when shot back because of a shotgun burst.

There are a few key positions you have to figure out doing. Obviously a crouched enemy or player that needs ragdoll physics effects can't suddenly be standing upright the moment the physics become active and then go down using physics after being killed.

I'd really like the angle thing to change though, it does make things uncomfortable,

Cheers
Posted By: HeelX

Re: Enabling physics on bones? - 06/03/07 07:46

Yes, of course, if you have two or three "ignition poses" for such a morph will be sufficient enough in most cases.
Posted By: Vision

Re: Enabling physics on bones? - 06/08/07 21:50

Thank you for the resposes, luckily I am not trying to enable these physics on a parental tree, but rather a tank with many moving parts.

Heelx, I was a little confused by your respose as well, are you suggesting to create another completely seperate bone structure to enable physics control on, aside from the player controlled skeleton which I currently have effecting the mesh animations? It made sense for me to do them all in one fell swoop.
Posted By: HeelX

Re: Enabling physics on bones? - 06/09/07 11:33

Quote:

Thank you for the resposes, luckily I am not trying to enable these physics on a parental tree, but rather a tank with many moving parts.




Uhm, you should have said this before. What do you mean with this exactly?

Quote:

.. are you suggesting to create another completely seperate bone structure to enable physics control on, aside from the player controlled skeleton which I currently have effecting the mesh animations?




The bone skeleton is used for animations yet and cannot be used as primary source for physics. So, to enable physics on a boned entity, you have to "rebuild" a unique skeleton, which fits the bone structure of the entity.
Posted By: xXxGuitar511

Re: Enabling physics on bones? - 06/09/07 19:05

...by "rebuilding" the skeleton he means creating models to represent the bones, not actually creating another skeleton on the same model
Posted By: Vision

Re: Enabling physics on bones? - 06/15/07 08:37

So I ended up rerigging this thing, and after enabling physics, and getting this tank up and running/driveable, i see how you can not use the physics to effect the bones to then effect the mesh. Hope that made sense.

I guess I want to take this a little further which is leaving me no other option than to fake it, so after digging around for a bit, I cant seem to find a way to pull in a bones location from the world and adjust it accordingly? Is this even possible? Or adding additional collision boxes to bones or seperate parts of a single mesh, or is it only one per entity.
Posted By: Tor

Re: Enabling physics on bones? - 06/15/07 09:00

I'm 90% certain collision is only a per entity basis. The other 10% requiring some serious hack workaround.

PS. I'm in the same boat as you right now. Gave up on trying to implement a .dll implementation of my network coode... and I'm just boot strapping it into my project raw. See ya tomorrow in class!
Posted By: HeelX

Re: Enabling physics on bones? - 06/15/07 15:39

As I said, you cannot enable physics on "bones" - you have to emulate it!

Bones positioning: when you reset an entity with its bones, each bone has a position of 0,0,0. This means: to determine the actual bone position you..

  • take the relative vector from the origin to the bone (maybe you have to scale it acordingly to the entity's scale)
  • rotate this vector with the entity's pan
  • and add to this vector the origin of the entity
  • now calculate the difference vector from the bone to the target
  • divide the length through the uniform scale of the entity
  • rotate the vector with the negative rotation of the entity


THIS vector result will be the offset you ADD to the bone so that the bone will be placed at the desired global position in space.

Hope, that helps you.

Cheers - Christian
© 2024 lite-C Forums