[Solved] Will PlayCanvas engine count skeleton data in rigid body?

The model file I feed to the engine contains skeleton data which, if I’m understanding this correctly, justifies the model to it’s supposed pose.
However, when this model is used as a rigid body, the shape of the “real” rigid body, where I can apply force to, does not seem to have the same shape of what is displayed.
So my guess is that the model displayed is not the same of the physical rigid body. PlayCanvas engine does not count skeleton data in rigid body.
Am I right?

The shape of a rigidbody (talking about rigidbody components here) is defined by the collision component. So to make something a rigidbody you need to add a collision component to it as well. In general you should use simple shapes like a capsule or a cylinder or a box for characters. Here is a tutorial on physics http://developer.playcanvas.com/en/tutorials/collision-and-triggers/ and more here http://developer.playcanvas.com/en/tutorials/?tags=physics

1 Like

Hi @vaios, thank you for your help.
Just a brief of the DOC and I get that I can only use static mesh as the type of a collision components.
My problem is, if the mesh I am using contains skeleton data, which obviously infects the shape of the mesh when it is displayed, will the skeleton data be counted in by the engine to decide what the real shape of a mesh is?
The word static suggests that the mesh should not be animated, and have no skeleton data.
Am I understanding it right?

The word static applies to the rigidbody components. There are 3 kinds of rigidbody components, static, dynamic and kinematic. Static are for things that do not move dynamic is for things that are fully managed by the physics simulation and kinematic are for things that affect other dynamic objects but themselves are not affected by them.

None of these change their shape automatically because of a skeleton. You need to do this yourself in code. For example you can add a child entity with a box collision component and then have a script that scales the collision entity depending on the aabb of the animated entity.

1 Like

Hi @vaios, thank you for your awesome explanation, the shape of a rigid body component will not be changed because of skeleton data, I get it now.
As you have suggested, I will dig more about calculating the aabb of an animated model.
:grinning:

The animated AABB is already calculated. Try entity.model.model.meshInstances[0].aabb (if you have multiple skinned meshes in one model, just iterate over meshInstances and combine AABBs with .add())

1 Like

@Mr_F What it is said? “You saved my day”.
Actually, You are saving my tomorrow.
Happy Fraidy :sunglasses:

1 Like