Using animation component on entities without models

Is it possible to animate a pc.Entity without a model component attached to it using pc.AnimationComponent? Looking at the documentation for pc.AnimationComponent I see that only models are mentioned.

My use case: I have animation assets that affect properties across a graph constructed in runtime (i.e. not contained in a model asset) but as I attach the animation assets to the root of the graph nothing happens. The animations work fine if attached to an entity that has a model with the same internal graph as the one I construct in runtime.

This is a simplified version of my scene structure. The animation asset referenced from the animation component could potentially contain animations for properties on the group entity and/or either of the child entities/models.

Scene
├── Camera
├── Light
└── Model group entity
    ├── Animation component
    ├── Model entity 1
    │   └── Model component
    └── Model entity 2
        └── Model component

If this is not currently possible, are there any plans to introduce this functionality in the engine? I see that there is a PR up for a new animation component and glancing over the changes there seem to be support for animating entity properties. Am I mistaken?

Hi @sajo, thanks for posting this question!

Is it possible to animate a pc.Entity without a model component attached to it using pc.AnimationComponent? Looking at the documentation for pc.AnimationComponent I see that only models are mentioned.

You’re right, this isn’t possible with the pc.AnimationComponent as it was designed to animate models using GLB / JSON animation asset files.

If this is not currently possible, are there any plans to introduce this functionality in the engine? I see that there is a PR up for a new animation component and glancing over the changes there seem to be support for animating entity properties. Am I mistaken?

The plan for the new pc.AnimComponent does include animating any property of an entity and it’s children rather than just the model. This is achieved by creating animation clip assets. These clips are similar to GLB assets in how they’re handled by the new pc.AnimComponent. However, they support paths to any arbitrary component property of the entity and it’s children. Animating entity properties will be handled by these new assets, while GLB assets will still be used to animate entity models.

From reading your use case, i’d imagine the pc.AnimComponent could fulfil your requirements. It is still a work in progress so the team is keen to utilise any feedback. You can use my branch to test the new playcanvas anim-component. I’d be interested to hear more about your workflow & how your animation assets are formatted!

3 Likes

Thanks for the quick response, @Elliott.

I see, thanks for confirming.

Sure, I will expand on my use case to clarify. I am running a fork of the engine and doing customizations to the recently introduced pc.GlbParser in order to support export of scenes with cameras, lights etc from a glTF file (rather than just a pc.Model) as this is something I need in an ongoing customer project. The animation assets I referred to previously are the same ones that are currently generated in runtime in the parser, i.e. pc.AnimTrack wrapped in pc.Asset.

I will try using pc.AnimComponent from your branch to see if that works.

If you’ve updated the pc.GlbParser to create custom instances of pc.AnimTrack, this should work with the new pc.AnimComponent as long as the curve paths in the pc.AnimTrack adhere to the correct format!
Using the basic example you provided before the curve paths should look something like:

modelGroupEntity.modelEntity1/model/yourProperty

I’ve been trying out the new pc.AnimComponent and it works great in my use case. Hoping it will get merged into the engine soon. I did however run into some issues with the typings and API and left a couple of comments on your PR.

Thanks for your help!

That’s great to hear. Thanks for the PR feedback too!

We’re aiming to merge this into master as private API next week. If you’re comfortable using it with the knowledge that the API may slightly change in the future then you shouldn’t have to wait very long :smiley:

1 Like