Question about joint constraints and physics bodies. #933
-
So I have a rag doll set up in the game. I have set up the rag doll using the RagdollSettings and defined the WORLD SPACE positions and orientations of the bodies and joint constraints. I've noticed that when you call setPose in the rag doll class it loops through all the rag doll bodies and sets the orientation and position for each of the bodies. However, the pose I am passing in consists of the joint positions and orientations for a specific frame of animation. How does Jolt place the bodies in the correct location and orientation if all I am passing in is the pose for the skeleton joints of an animation frame? I assume it accounts for this with the information I have passed in with RagdollSettings when creating the rag doll? And a similar question is when I call GetPose in the rag doll class, it loops through the bodies that are registered with the rag doll and returns the position and orientation of each body minus the root offset. While this is good if you are placing geometric representations of the bodies that make up the rag doll, I actually need the joint positions and orientations of the skeleton. I plan to use that to then skin a character mesh in the game. Is there a way I can get the joint position\orientation for the rag doll skeleton as opposed to the bodies? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
The assumption is that the body position/orientation IS the joint position/orientation. E.g. a capsule shape would be offset using a RotatedTranslatedShape so that it is correctly placed if you put the body on the joint. |
Beta Was this translation helpful? Give feedback.
-
OK assume I have a leg joint as LThigh and it is positioned in world space at constraint_position 0.0934882 0.332284 0.0 // LThigh I then have a capsule shape positioned in world space at: shape_position 0.1 0.21 -0.04 // LThigh Here is a picture: So currently I am assuming that this is NOT possible since the capsule shape is not centered around the LThigh joint as you Currently I set the rag doll body like so:
Based on your statements, this is an incorrect set up that will not get me the desired result. I also noticed that in your CreateRigTest.cpp example your capsule shapes positions[] are offset from the constraint_positions[] defined in the file. Of course if you are only drawing the body shapes (as in the example) all is well. However, this won't work well with an animated polygonal mesh. Is there no way around this? ie. I HAVE to have the capsule shape in the exact same position as the joint even if it doesn't match the polygonal mesh to get this to work? I don't see how setting it like this:
And then setting the part position as well as the swing twist constraint settings to be the same position of 0.0934882 0.332284 0.0 would make any difference in what I am trying to achieve. For example:
Perhaps this is the correct way to set this up for my use case. If it is not, could you please provide some really simple pseudo code to set up my rag doll LThigh joint example? Thanks in advance for any help you can provide! |
Beta Was this translation helpful? Give feedback.
-
Instead of:
you need:
You want to translate the shape so that if you place the body on the joint position that the capsule is in the right position. |
Beta Was this translation helpful? Give feedback.
-
One thing I forgot to mention. For the arms since they have been rotated and are capsules the code would be (Assuming same positions as the legs described above):
Or do I set the rotation in the part as shown in CreateRigTest.cpp instead?
|
Beta Was this translation helpful? Give feedback.
Instead of:
you need:
You want to translate the shape so that if you place the body on the joint position that the capsule is in the right position.