Comments (4)
Never mind! Figured it out with some effort.
Followed this article and it was pretty simple to make it work with legacy Animation
API. Couldn't figure out how to make it work with latest Animator
stuff yet, and what works is good enough for me right now.
Here is how you do it...
// Create new mesh.
AnimationClip[] animClips;
GameObject result = Importer.LoadFromFile(Application.dataPath + "/GLTF/BrainStem.glb", new ImportSettings(), out animClips);
// Setup animation, if there is any.
// Taking only the first clip for now. Should be pretty easy to extend it to generalize
if (animClips.Length > 0)
{
Animation anim = result.AddComponent<Animation>();
animClips[0].legacy = true;
anim.AddClip(animClips[0], animClips[0].name);
anim.Play(animClips[0].name);
}
from gltfutility.
@SimonDarksideJ Did you find out to work this out?
@Siccity Thanks for this awesome work man! I have been working with GLTF for quiet a while now. But first time with Unity. Was surprised that it is not supported natively. With a little bit of search found your repo.
Worked out the basic model loading at runtime stuff. But stuck with animations. Some example would help a lot.
from gltfutility.
Thanks @Atekihcan , hadn't gotten back to this as I hadn't heard anything back from @Siccity
from gltfutility.
Potentially the code I've posted using the Playables API in issue #89 is the way to go. I'm also looking for a way of handling animation.
from gltfutility.
Related Issues (20)
- When trying to load glb file in editor, application hangs on Application.EnterPlayMode HOT 1
- Glb model fails to load on android HOT 1
- Async import in editor not suported
- No way to set individual loop settings for animation
- How can i add and Play animation file in runtime
- Not possible to update shader's materials HOT 2
- InvalidOperationException
- Error while downloading model from server at runtime in webgl
- Support for intensity of emission
- Not work at Unity2019.4.28f1 URP
- Animation doesn't work on android!
- GLTFImage.cs ToTexture2D() ERROR: Cannot connect to destination host When Importing
- Model not importing on android HOT 1
- ImportSettings.materials does nothing?
- README change
- Play animation on iphone not working
- Mesh tearing at a distance
- Build error
- error CS0117: 'ImportSettings' does not contain a definition for 'useLegacyClips'
- Plugin usage documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gltfutility.