Best way to go about placeholder animation

Hi everyone,

I am trying to create a generic animation with multiple independent points (bones) which I can then dynamically parent other models to.
An example of this could be an assembling animation for a car, but where some or all of the pieces can be customized by the user (dynamically during runtime).

I am using Blender for my 3D software, and have been trying to export:

  • Animated empties
  • Armatures with animated bones

It appears that only the animation from the empty objects is imported. Similarly for the Armature (no mesh) only the animations are imported but no entity.

How can I best setup such a generic animation with multiple moving points, each of which can have another object parented to it?

Thanks in advance :slight_smile:

Can you provide an example FBX of the animations you are trying to import please?

I have included both the (Blender) source file and the exported FBX.
The setup includes: Armature with animated bones + empty objects parented to the animated bones which will be used to dynamically parent objects to (and to obtain bone position / rotation).
https://drive.google.com/drive/folders/1E5fpepms_cYz4WW5GXTApvkQgP7-7_TB?usp=sharing

Importing the exported FBX back into Blender works fine with all animations, empties and bones maintained. However in PlayCanvas just an empty glb model shows up along with the animation and source fbx file.

When I use view the GLB in the viewer, the bone animation looks like this, is this right?

20201213-0940

The model doesn’t seem to have any meshinstances which will be a problem :thinking: No meshinstances means that there are no graphNodes to attach to.

I do wonder if it’s possible to create an entity hierarchy in the scene to match the one you have in blender to animate?

Looking at the animation and model code in the engine, it looks like it could be hacked around but you may be better off using an actual model

1 Like

Ok so I did some experiments and as you mentioned at least 1 face is needed on the objects parented to the bone before it displays properly. 1 vertex or 1 edge is not sufficient.

The hacky solution here would be to include a mesh with at least 1 face for each bone but set the material to be invisible.

While this solves the initial problem, it introduces 2 additional problems:

  • How can I parent an external entity to a single mesh instance, given that all armature meshes are combined as a single entity.
  • How can I obtain the world position / orientation / scale of a mesh instance?

Ideally I would prefer not having to calculate world position etc. every single frame and manually updating the transform of each child object.

This is the set up that gets created when you load the model json / glb: The entity has ModelComponent on it. This points to a model (https://developer.playcanvas.com/en/api/pc.Model.html) and this has the graph property which contains the hierarchy inside the model.
So you can attach child objects to graph nodes in the hierarchy, and read / write their local / world positions.

We’re in the final stages of importing fbx into glb and a hierarachy stores as a template (prefab) … when this is released, you can drag & drop your imported fbx file into scene and see / modify the hierarchy. The engine side of this will get released with the engine release this week … but the editor support is few weeks away still. https://github.com/playcanvas/engine/pull/2488

2 Likes