Replies: 2 comments
-
I believe I mistook the extra Would love confirmation on 1/2 though, if those are just expected side effects of having to pair an additional rigid body! |
Beta Was this translation helpful? Give feedback.
-
I think you probably use a RotatedTranslatedShape containing a CapsuleShape to position the capsule the right amount above the ground. If this is the case then the CharacterVirtual position is indeed at its base. If you create a Body with that same shape, its GetPosition() should then also be at the base (in the same position).
Kinematic bodies simulate during the physics time step, so it will indeed move to the correct position in the next frame. Doing it like this allows the rigid body to properly push other bodies. If you want to move the body instantly, you'd use BodyInterface::SetPosition instead. In case of a VirtualCharacter that should be fine as it will be the VirtualCharacter that should have detected collision with anything in the way and applied the correct forces. Note that there are quite a lot of questions on this subject, so I'm currently working on making it easier to work with the CharacterVirtual class. You can track it's progress here: https://github.com/jrouwe/JoltPhysics/tree/feature/char_vs_char |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm wondering what the right way to set up a rigid body pair for the CharacterVirtual?
Following the docs, I've tried adding the methods of adding a kinematic body and dynamic body, but am running into somethings that makes me think I'm misunderstanding something
This just seems like a consequence of the API, but it feels a bit weird for the paired body to have to be manually translated to match what essentially is its parent
Given that they're supposed to represent the same body, it seems odd if the position resolution lags behind by the
deltaTime
? When I try applying a deltaTime of 0, it just sets the position toNaN
. Am I thinking about this wrong?I was able to fix this following this helpful thread with a custom body filter that filters out the specific bodyId,
but this led to another issue:4. The overallphysicsSystem
contact listener's onContactAdded seems to be triggered by both the CharacterVirtual and paired rigid body, when touching other objects in the scene. However, only the paired rigidbody is triggering sensor'sI'd have expected that no listeners would be triggered, given that we have to add this paired rigidbody. I'm also confused because I thought the CharacterVirtual doesn't even have a body - so I'm not sure how the contact listener detects a pair?Am I supposed to be filtering out the CharacterVirtual somehow across the entire physics system?(figured out why this was happening below)Is this all expected behavior, or am I doing this wrong?
Beta Was this translation helpful? Give feedback.
All reactions