Clip.fromThree() to create Clip from Three.js AnimationClip#20
Clip.fromThree() to create Clip from Three.js AnimationClip#20ArsenicBismuth wants to merge 1 commit intosketchpunklabs:mainfrom
Conversation
|
This is a great idea. If Clip/etc will be library agnostic though, it may need to be in a separate utility though, f.e. |
| let track : ITrack; // Animator Track | ||
| for ( const t of anim.tracks ) { | ||
|
|
||
| switch ( t.constructor.name ) { |
There was a problem hiding this comment.
I encountered issues with the minified bundle when using constructor.name, as the bundler sometimes changes object names, leading to crashes. A possible solution is to adjust the bundler settings and use Terser. However, if there's a way to avoid relying on constructor.name, it might prevent this issue. Just wanted to share in case it's helpful.
There was a problem hiding this comment.
The safest solution I think might be to use instanceof conditions. There is only two Track types in ossos but more in 3js. Something it should be easy to just do
if( t instanceof VectorKeyframeTrack ) track = new Vec3Track();
else if( t instanceof QuaternionKeyframeTrack ) track = new QuatTrack();
else continue;
I've rebuilt the animation system for the next version of ossos, So there are big changes in alot of places.
https://github.com/sketchpunklabs/ossos/tree/ossos_next
|
No engine specific things will be built into the library as one of the goals is to be engine agnostic. Like 3js, lots of the extra bits will be in an example folder or maybe some sort sub engine specific utility library people can use. |
Just a simple utility to add more method to create ossos.Clip(), need the armature of the source model to get the bone mapping data.