[SOLVED] Compound rigidbody interactions

This is related to several other topics I’ve posted, but I don;t think I’ve found an answer for it. I have an entity in my scene with a kinematic rigidbody, with several child kinematic rigidbodies attached to it. When I apply torque to the parent entity, the child entities rotate just fine along with it, but the second separate entity with a dynamic rigidbody doesn’t interact with the child rigidbodies like I want it to. Is this because the child rigidbodies are kinematic and need to be dynamic or static, or are the child rigidbodies on some other physics layer that the second entity is not?
Scene here: PlayCanvas | HTML5 Game Engine (first entity being the wheel, second being the pointer)

Are you using code to compound the rigidbodies or are you expecting that if you have child rigidbodies that they compound automatically?

I’ve had people recommend using compound rigidbodies before, I didn’t realize there was coding component to making it work though. I’m still getting used to a lot of things with Play Canvas, and coming from Unity, there’s a lot of things I’m used to automatically happening that don’t with this engine.
What I’m asking about here is also similar to how I’m currently implementing the movement for the pointer entity, except I’m using a separate trigger collision to change the default rotation of the pointer.

PlayCanvas does expose compounding physics objects through the engine. You have to do via code in Ammo as I touched upon it here. I recommend looking at Will’s project here for hints: https://playcanvas.com/project/431888/overview/ragdoll

Ok, this looks like it has quite a few other things I’ve been thinking about trying as well.
One thing I’m not quite clear on, how does he select which of the three constraint scripts goes to what joint when they’re all in the same script?

I’ve been trying to use the hinge script used in the project to make a hinge for the pointer, but it’s returning an error around this.app.systems.rigidbody.dynamicsWorld.addConstaint(this.joint, this.disableCollision);, saying it’s not a function.

Project link please?

In first post. If you need to see the script here’s a link to it. Called Hinge.js.
https://playcanvas.com/editor/code/532971?tabs=11402284

It isn’t being used in the scene though? If you get to the point where you are trying to use it and then fork the project to post here, it be easier for someone to come along and debug it.

Whoops, my bad wrong link.
https://playcanvas.com/editor/scene/593574

So I fixed it here: https://playcanvas.com/editor/scene/593835

Several issues:

  1. Pointer was not set on the hinge script in the scene
    image

  2. The script needed some re-parsing

  3. addConstraint was misspelled as addConstaint

Always takes someone else to find those small things.

I did that accidentally just a little while ago, I was playing around with collisions and changed the pointer enough to separate the connection.

Alright, new problem with this script. The orientOffset attributes are returning NULL and causing an error on line 48.

Hinge.js: https://playcanvas.com/editor/code/532971?tabs=11402284

Reparse the script in the editor. Had the exact same problem. Some of the attributes names may have been changed (?) and some values are not being passed:

Ok, all fixed. Rigidbodies still don’t interact though. What I’m doing here: https://playcanvas.com/editor/scene/593574, is similar to what I do here: https://playcanvas.com/editor/scene/592656. The difference being the second scene uses a trigger zone instead of a rigidbody to move the pointer.

EDIT: Seems to work when the pearls rigidbody is dynamic but not when it’s kinematic.

Is someone able to explain to me how the part orientation offsets from the ragdoll project @yaustar posted here (Compound rigidbody interactions) are supposed to work? I forked the project to play around with it and try and figure it out but I can’t make sense of these.
Here’s my forked version, I also can’t figure out why the joints on the test dummy guy I made are ridiculously long and not attached to the right places.
https://playcanvas.com/editor/scene/595364

Anyone? Still need help with this.

EDIT: Got part of it, the hinge script was targeting the wrong entities. Still making the joint oddly long though.

Got the joint working to an extent. I can see it with the debug draw, but for some reason gravity seems to stop affecting the dynamic rigidbody and the joint forces the dynamic rigidbody above the static one and just holds it there. I had the pointer fall under gravity at one point (changed the size of the static rigidbody and it fell), but it just kept on falling and the joint never stopped it.

Compound Collision Shapes are now supported natively in the Editor:

Simply set a collision component to have a type ‘Compound’ and create as many child collision shapes as you like. Yay!

Cool. Probably could’a used that on our tree.