Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by siddharth3322 · Mar 21, 2015 at 04:54 AM · gameobjectfbxunity 4import model

Convert fbx model to gameobjet

For my game I am fetching 3d objects from online server. So I receive fbx object as imported file. So at runtime I want to use this file in game. I need some suggestion to convert this fbx object model into unity gameobject.

Means I need some code to convert this file so that I can use it in actual game. Please give some suggestion in this. If you have any other way then mention that also.

Comment
Add comment · Show 1
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 siddharth3322 · Mar 23, 2015 at 04:50 AM 0
Share

Please friends I need your help in this. Following discussion give you more details about question

Convert fbx model to gameobjet

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by fafase · Mar 23, 2015 at 05:12 AM

You would be better of storing the model as obj. Fbx has the animation but there is no runtime parser for fbx that I know of.

With obj, you would grab the text file from server, parse it using http://wiki.unity3d.com/index.php?title=ObjImporter

Then you need to add a mesh filter, a renderer, connect those together, add the newly created mesh from the parser to the mesh filter, add a material, parse the material info and fetch the matching shader and apply to material.

All in all, you simply parse the file to get the info, create the item via AddComponent and aply the data. That may sound complex, it is actually simple.

 WWW www new WWW(url);
 yield return www;
 string text = www.text
 ObjImporter importer = new ObjImporter();
 Mesh mesh = importer.ImportFile(text);
 GameObject obj = (GameObject)Instantiate(prefab); // Prefab already contains all components
 obj.GetComponent.<MeshFilter>().mesh = mesh;



Comment
Add comment · Show 3 · Share
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 siddharth3322 · Mar 23, 2015 at 05:55 AM 0
Share

@fafase, Thanks for your suggestion. Wether designer give me this text file as object file? Or I have to process some other task for getting this text file.

avatar image fafase · Mar 23, 2015 at 07:16 AM 0
Share

You would get it from the guy making the models. It is a setting in the export process for $$anonymous$$aya or 3Dmax. Then you are given an obj file, which is a just a text file with specific pattern to be parsed by obj parser.

avatar image siddharth3322 · Mar 23, 2015 at 07:19 AM 0
Share

@fafase, Thanks for your reply. I got your reply what you are trying to say. I move ahead in same way. If in future I stuck then I post comment at here so please reply next time also.

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

21 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

Related Questions

Syntax for a game object component variable on a transform in an FBX hierarchy? 1 Answer

Scale and Rotation Issue with Model Import 3DS Max to Unity 3 Answers

Transform.gameObject References Itself?! 0 Answers

Warning(s) found while importing this animation file. 0 Answers

How to store player model and then swap the model to an object I Raycast hit? 0 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