Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by sdi1000134 · Jul 10, 2017 at 02:24 PM · webglfbxruntimeanimationclipfbximporter

Load .fbx from remote http server at runtime to use it as animation clip at runtime

I would like to implement a WebGL application where animationclips will be downloaded from an http remote server and loaded to a 3D model's AnimatorController at runtime. For example, the following code shows that the user can type a url to the input field and when they press the "Submit" button, the system should go connect and login to the server, and then download the fbx which will be used as animationClip for the 3dmodel:

 using System;
 using System.Collections;
 using UnityEngine.UI;
 using UnityEngine;
 using UnityEditor.Animations;
 using System.Net;
 
     public class DownloadAsset : MonoBehaviour{
            
         public InputField nameField;
         string url;   //the url that contains the path of my animation clip (fbx) to be donwloaded or streamed
 
         public AnimatorController AnimationController; //the animatorController of my 3d model
         public AnimationClip AnimationClip;   
         
         public void OnSubmit(){
                   url = nameField.text;
                   WebClient myClient = new WebClient();
                   myClient.Credentials = new NetworkCredential( username, password );
                   myClient.DownloadFile ( url, "C:/Users/myusername/Desktop" );
                   //Somehow I load my donwloaded or streamed asset to a variable of type AnimationClip and load it to the AnimatorController of my 3dmodel
 
                   Motion motion = (Motion)animationClip as Motion;
                   animationController.AddMotion(motion);
         }
     }

  1. How can I save the downloaded fbx to a buffer and then load it to unity?

  2. In this code I am using using UnityEditor.Animations which means that I will have problems when building the app.How should I alternatively use functions for animations to add an animationclip to a animatorcontroller at runtime?

Please note that I will build it as WebGL app and everything has to be done at runtime.

Thank you for your patience!

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image karsnen · Aug 07, 2018 at 09:07 PM 0
Share

I need an answer to this question as well. If you or anybody knows, please point at the right direction. Thanks.

avatar image Cherno · Aug 07, 2018 at 09:18 PM 0
Share

You need TriLib - Unity model loader package to load animated FBX files at runtime. I'm not sure if it will work with the Animator component, maybe you need to look into using a RuntimeAnimationController. The Animation component works by default, though.

avatar image Bunny83 Cherno · Aug 08, 2018 at 09:48 AM 0
Share

Note that "TriLib" does not explicitly mention WebGL support:

$$anonymous$$ulti-platform: Windows Store, Windows, Linux, OSX, Android and iOS.

It may work but i would contact the creator before buying. Also note that most of this asset consists of open source code. So it's mainly a bit of necessary boilerplate around assimp and to convert the mesh, animation, ... data into Unity's $$anonymous$$esh, animationClip, ... classes.


Note that the native assimp library is rather huge since it supports many different file formats. If you just need FBX support there may be some simpler dedicated pure managed solutions. I haven't tested any of those. This one isn't Unity specific, so it just aids with the pure loading and decoding of the FBX data. The actual $$anonymous$$esh or AnimationClip creation is up to you. You have to decide if you think you are capable of implementing it yourself. If in doubt TriLib may be the better choice (if it actually works for WebGL) if you really need FBS support.


Depending on your restrictions / requirements you may want to use a different format (maybe a propritary format or Unity's asset bundles).

avatar image karsnen · Aug 08, 2018 at 08:45 PM 0
Share

Thank you very much for responses guys!

avatar image karsnen · Aug 08, 2018 at 08:53 PM 0
Share

As for TriLib is concerned, this document explicitly states that there is no WebGL Support. https://ricardoreis.net/?p=127

avatar image jcbadboy · Aug 10, 2018 at 08:11 PM 1
Share

Hi @sdi1000134

same problem here. do you solved your this problem?

avatar image karsnen jcbadboy · Aug 10, 2018 at 09:27 PM 0
Share

I'm trying as well. $$anonymous$$aybe trying to figure it in a different way with Easy Save would make it happen. But please update if you have and so will I.

avatar image jcbadboy karsnen · Aug 17, 2018 at 12:48 PM 0
Share

The way I am doing it now is to parse the fbx out of the unit webgl container. So, i am using three.js to load and parse the fbx file from internet and deliver this data as json (or as by$$anonymous$$rray for better performance) Then, you can re-assembly this data as a mesh in unity.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

76 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to load a large number of fbx files in runtime(files from Navisworks) 0 Answers

FBX Animation Clip Root Transform Rotation ignored in WebGL v2017.1 0 Answers

How to Load external files (.fbx) at runtime? 3 Answers

Problem with adding new Animations to existing FBX 1 Answer

Manually Animating Bones then blending with existing animations or saving importing as fbx 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges