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?
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.
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