Copy/Re-use animation from one instance on another one with the same skeleton
- Dominant language
- C++
- Stars
- 20.5k
- Forks
- 2.3k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 74
Description
**Is your feature request related to a problem? Please describe.**
In my use-case I have a main character model. This model contains all animations for the character.
I now have many other models that are clothes or accessories that have the same skeleton as the character, but don't contain any animations.
When the character equips for example a hat and we run the idle animation of the character, we copy over the idle animation to the hat model. Playing both simultaneously gives the impression of the hat fitting on the character's hat, as it's following all of its animations.
The current app code is written in threejs but we want to migrate to filament, and we're wondering if we can use the same approach with filament.
Here is an example code snippet of how to do this in threejs:
```ts
// this._character being the main model with all animations and
// this._accessoryObject being the accessory model we want to copy the animations to
this._character.copyAnimationsTo(
this._accessoryObject.animations,
this._accessoryObject.mixer,
);
copyAnimationsTo(animationsMap: { [key: string]: THREE.AnimationAction }, mixer: THREE.AnimationMixer) {
const animations = this._character.animations
animations.forEach(animation => {
const animationAction = mixer.clipAction(animation)
animationsMap[animation.name] = animationAction
})
}
```
**Describe the solution you'd like**
I haven't thought of any exact solution yet, as I feel it might introduce a new API (if the feature doesn't already exist?) and I don't have any specific API in mind.
Maybe something like:
```cpp
animator->addInstance(otherAsset->getInstance())
```
**Describe alternatives you've considered**
I see that the `Animator` has (internal) code i.e. `addInstance`, however thats internal and only usable with an FFilamentInstance.
**OS and backend**
I think it's not.
Contributor guide
Assessment
This issue has not been assessed yet.