maxartz15 / VertexAnimation

Vertex animation baking tool, shaders and animation system for Unity DOTS/ECS.
MIT License
438 stars 85 forks source link

Multiple animators in the same scene #9

Closed SergeyVolik closed 11 months ago

SergeyVolik commented 2 years ago

Introduction

Hi there. I found a bug when I use two or more animated models in the same scene.

https://user-images.githubusercontent.com/29128689/154809559-3fd64ed9-9985-4996-8720-5b6c4035fa9f.mp4

I have decided to figure it out. I found a problem in VA_AnimationLibraryComponentAuthoring. You use static field https://github.com/maxartz15/VertexAnimation/blob/4499f67f3122b1c6a8def5c4b7ad431d79791cb6/Runtime/Scripts/VA_AnimationLibraryComponentAuthoring.cs#L17 for all animated models.

Solution

I have rewrote this logic and now I generate Hash128 for each animation library VA_AnimationLibrary.cs. By the way Hash128 work only with guid strings.

Result

https://user-images.githubusercontent.com/29128689/154811015-4a54b498-c014-4c79-8e8a-0b857ade0ada.mp4

I also updated the old samples and added the sample 4 scene.

maxartz15 commented 2 years ago

You can have multiple animations/animated models already. Currently you can only have one loaded animation library. This animation library can contain multiple animation books from all kinds of models. What would be the reason to have multiple animation libraries? If that is really needed, then I think we should remove the libraries al together and have the books load them self in.

maxartz15 commented 2 years ago

You can read more here

maxartz15 commented 2 years ago

@SergeyVolik does that solve your problem or is the change you made necessary/useful? (btw, thanks for looking at the project, much can be improved, keep the suggestions coming :) )