I want to using the Unity3d framework for a project in which I have create a walkthrough. But the client want it to be dynamic.
We would be getting the final fbx file from 3DMax which when added to a particular folder a walkthrough should be created automatically. I went through the help files on Unity3D site but did not find any documentation as to how use the Unity3D framework programmatically.
Can anyone please let me know how can it be done? Even if link is provided for the resource it would help us.
Unity 3D has a built in way to load models at runtime, but this should be done using a Resources folder (Resources.Load()) or using a Asset Bundles (AssetBundle.Load()) as described here: http://docs.unity3d.com/Documentation/Manual/LoadingResourcesatRuntime.html
These two methods are performed inside the Unity editor and your need is load any arbitrary 3D model file at runtime, for this case you will need a plugin. The only one that I know is ObjReader.
Related
My goal is to read a XLSX file and use this to generate objects in Unity3D. However this app is for a hololens. It is possible to let the game ask the user to select a file which it should import (at runtime)? like how a regular windows forms app opens an explorer window and lets you browse for a file.
so, just to clarify, what i DONT want is to import the XLSX file as an asset before building the app (because the game shouldn't be limited to just use that file!).
Let me know if the question isn't detailed enough, I'll try to specify it more if needed.
Unity itself doesn't have any way to implement a filebrowser on runtime however people have made their own versions of a filebrowser which you could use. Something like the ImprovedFileBrowser by Daniel Brauer. Which was inspired by a Filebrowser made by AngryAnt
Note: The ImprovedFileBrowser uses the ImprovedSelectionList which you will also need to get it to work.
I'm just starting to create a controller for use with Airconsole. I'd like it to be somewhat complicated and will be using Angular to create different pages.
In Unity, I can drag in a controller.html file. However, I've been getting resource not found errors when I try to access say controller.js or controller.css. How can I upload multliple files to the Airconsole host? Is there a general pattern used by other games?
So far I'm considering
hosting my app separately and just redirecting to my separate web page. This seems to give errors in the emulator though.
Compiling the entire app into just one HTML file.. Not sure how to get these entirely into one file. When I run ng build I get a smaller dist compiled file, but it still consists of several smaller files. Will try dragging that into Unity and trying again. But dragging the entire Angular project inside Unity felt like a really bad idea..
Link to files hosted on separate pages but still have the uploaded HTML file do something.. But not sure how much I need to do here vs how much I can move to other files that I host.
You can create your controller using controller.html with Angular (1?!), have different pages (e.g. via ng-include and the angular routing module) and upload everything to AirConsole (developers).
By using ng-include you can have multiple .html views you dynamically load into the controller.html.
I once wrote an example app for AirConsole and Angular:
https://github.com/francois-n-dream/airconsole-angular-phaser
Just think of it as if you would make a (mobile) website which in addition uses the AirConsole API for device communication.
My basic "how to include other files" question was answered well by another question: How to include js and css.
For the more generic question of working with Angular, I still haven't quite figured it out. But what I'm doing at the moment:
I have an Angular project outside of Unity. I run ng build to compile everything into a folder dist. Then two options work:
Deploy the dist folder to static file hosting and change index.html's relative links to point to the separately hosted files with <base href="https://cloudfilehosting/airconsole-host/">
OR
Copy the dist folder into Unity's Assets/WebGLTemplates/AirConsole folder.
I have using Phap 2 pro for my graduation project.
The project theme is 3D object recognition using Google Tango.
So, I run the area learning in Project Tango SDK's example!
I need the area learning data!
However, I can't find it.
Where is the learning data stored?
Area description picker image
I can't find where ADF is stored from Google's document.
I think there is no specific path to ADF.
But we can export ADF to any path by using areaDescription.ExportToFile(string filePath)
How to use :
AreaDescription m_areaDescription = AreaDescription.ForUUID(string UUID);
m_areaDescription.ExportToFile(Application.persistentDataPath);
reference
UUID is an unique ID allocated to each ADF. In your picture, small size string like "7ad2e08e-..." is the UUID.
ADF is a binary file. So you can't use this outside a Tango application. If you want a captured mesh data, maybe ExperimentalMeshBuilderWithColor scene can be helpful.
good luck!
I personally never managed to get into Area Description Files, but looking at your question here are two facts that came to my mind:
The A of ADF is for Area... so I am not sure that the learnt data can help to recognize objects (except maybe for some key points)
PTC (Vuforia) recently came out with 3D objects recognition in their SDK (if you haven't checked it out already, their demo is pretty cool)
I'd like to load "dynamic" assets (in particular, FBX files) that are located outside of a "Resources" folder so that the user can add/remove/modify files with no need to re-build the project.
To make those files easily accessible for the user in different kinds of devices (target platforms are desktop/android/ios), it seems reasonable to use either Application.persistentDataPath or Application.streamingAssetsPath.
Now the problem is: How do I load them (as proper Unity objects) ?
This obviously can't be done via Resources.Load() as they are outside a "Resources" folder.
Using WWW, retrieving the files should be easy and it could actually work for some types of files (e.g. textures, see http://docs.unity3d.com/ScriptReference/WWW-texture.html) but I cannot see a way to load something else.
The idea is that I'd like to be able to use those loaded objects like so:
(GameObject) Instantiate(loadedObject, new Vector3(0, 0, 0), Quaternion.identity);
I would really appreciate your help (preferrably with a solution that does not require a "pro license").
I know two options that you can try to use in this case:
Build an asset bundle for each dynamic asset you want to load, but this seems not really what you desire, because the user still have to use Unity3d to generate the asset bundle.
Use an custom 3d model loader, like described in this post, seems the best fit for your case.
What is the best way to load a 3d model from a URL inside of unity at runtime. I have tried this obj importer
http://wiki.unity3d.com/index.php?title=ObjImporter
But the mesh in not imported properly. What other options exist? Assetbundle needs a pro version and even that won't solve as I need to load a 3d model from url. Any suggestions?
The way to go would be asset bundles. They are Unity's (proprietary) way to load prepackaged, compressed assets from a file or an URL. All asset bundles must be prepared and built in Unity Editor.
If you need a more general approach which loads a raw file format like fbx, obj, 3ds, collada, et cetera, you should use the Assimp library. Assimp library is written in C++ but there is a wrapper for C#.NET here.
There are also wrappers for Unity like this Unity Assimp being free but quite outdated. The Asset Store though is packed with format specific importers including this free OBJ importer.
2021 update
Unity now also has Addressables which are an evolution of the aforementioned Asset Bundles. In a sentence, Addressables are memory managed, asynchronously loadable resources that can be loaded from local or remote end points.
There are a couple of libraries available to load 3d model from a URL in Unity.
These are the best two libraries to load the model from remote location at runtime.
Asynchronous Importer and run-time Loader for Unity
Runtime OBJ Importer
Asynchronous Importer and run-time Loader for Unity is quite a useful tool to import obj files from a remote location with texture and materials. where the Runtime OBJ Importer might miss the texture/material of the model.
Demos:
https://github.com/codemaker2015/unity3d-runtime-model-importer
https://github.com/codemaker2015/Runtime-OBJ-Importer-Demo