Saving Unity mesh created from Tango's Meshbuilder - c#

I want to be able to save the mesh I generate from the Unity mesh builder. From what I can tell the way most people save is with the point cloud data however, I would much rather have the mesh that is generated inside Unity or data so I can recreate the mesh generated in Unity . When I looked into some of the scripts I found a few scripts that seem to deal with the data that is involved with the mesh
CustomPointCloudListener.cs
DynamicMeshCube.cs
DynamicMeshManager.cs
Polygonizer.cs
Voxel.cs
VoxelHashTree.cs
https://github.com/googlesamples/tango-examples-unity/tree/master/UnityExamples/Assets/TangoExamples/ExperimentalMeshBuilder/Scripts
What would be the best way of getting the mesh? I was thinking of trying to save the data by modifying one of the scripts above but I'm not sure where to even start with this.
Edit: the main reason I don't want cloud point data is because I would have to run it through something like this
https://blender.stackexchange.com/questions/7028/wrapping-a-mesh-around-point-cloud-with-cavities

I believe you want to look at the calls into the polygonizer, which is using enhanced marching cubes to extracting the surface. Work back from there to get your mesh (sorry, doing this from memory, don't have the code in front of me)

Related

Unity make ScriptableObject on a build

I'm new to scriptable objects, but I've seen a lot of tutorials using them for an inventory system and recipes. My question is if it is possible for a future player of my game to create new "recipes" in the final build that will be saved as scriptable objects. Similar in Minecraft where you can use data packs to create new recipes.
ScriptableObjects aren't really intended to be used that way. They are assets in your build, just like objects saved in your scenes during edit time.
One option could be to try to save them as Addressables or AssetBundles so the game could load them dynamically. I don't think any of those facilities are available at runtime, so you would have to jump through a lot of hoops to get the storage format correct. I'd recommend against that and just use regular object serialization to save stuff.
It's worth noting, when you run your game in the editor and directly update your ScriptableObjects at runtime, it will update the asset and will save with the project. Although it might seem like its working, that only works in the editor. In a real build of your game it will not be saved, and will have it's original values every time you start your game (just like the scene objects all return to their original states).

Recovering inspector values from Unity build

I made the stupid mistake of moving a C# script out of the project and back in. This, of course, cleared all of the important inspector values back to their default values from the script.
All I need is to see those values again and re-enter them. I attempted decompiling the assembly-csharp.dll from my last build using dotPeak. While this did recover the correct classes and their fields, all of the fields are not defined. Where in a Unity build are these values stored, and is it possible to decompile them there?
Thanks in advance!
As far as I know there are stored in the scene file (.unity) or, if it's a prefab, in the prefab file (.prefab) (and if it's a prefab in the scene, it's stored in the prefab file with a list of modifications in the scene file). You might have success finding some values in there, but those are serialized and you can only really read them with Asset Serialization Mode "Force Text". It might also be that they lose their value when you open Unity between moving the script out and moving it back in.
Edit:
I missed the part that you wanted to read them from the build. I don't think that's possible, as they are normally serialized (if they are not in Streaming Assets). As scene files (which I think would contain the data) are also just files and not scripts that get compiled, I think the values are in one of the serialized files.
Also: You don't happen to have any kind of version control? Because then you could rollback to an old commit that contains that data, or if that's not possible look at the specific file in question.

SolidWorks API - How can I get the positions and rotations of all parts for all keyframes/key properties in a MotionStudy (Animation)?

as the title says, I try to get the local position and rotation values of all parts in an assembly that get moved in a MotionStudy. I'd like to be able to recreate an animation that already exists in SolidWorks in other environments like e.g. Unity. Therefore I need to read the time and transformation values of each keyframe in the MotionStudy.
I've dug through the API but I couldn't find anything promising. I can get access to the MotionStudy object itself, but I can't find valuable information in there. I also tried to get motion features and properties, but the returned objects were not useful at all.
Link to the API section for MotionStudy : SW API MotionStudy
I really hope that someone has already managed to do this.
Thank you.

Should i encrypt my Unity code for build IOS game?

As we all know ,if the Unity game for android apk most can be reflected to get the Assembly-CSharp.dll source code. I hear someone say that Unity game for IOS after build had encrypted , if this is true, i have not to take more time to protect my game code . But if this is not realy, what can i do to protect my code on IOS and Android.
To cite the page from the unity manual about Asset protection (bundles)
[...]our general stance is that if users are determined to extract
your assets, they will be able to. - http://docs.unity3d.com/Manual/protectingcontent.html
The doc that Minzkraut cites in his answer is about protecting your 3D assets and textures. If you want to protect your code, an easy thing would be to use an objuscation software on your classes. I found one just by writing "obfuscation in unity" on google.
Now, it will make the job of reading your code way more difficult, but it will not encrypt your code so it is not 100% secure.
For most applications, I suppose that there would be no real need to encrypt your code anyway. As for other assets, if someone is truly determined to read your code, he will find a way

Questions about XNA, bvh, 3dsmax, FBX, biped, CAT objects, Poser, makehuman, lip sync etc

Questions regarding XNA and skinned animations.
My main objective is to create a biped with my wifes face on it and apply bvh files to it to use in some wp7 game/app... So I have gotten confused about some thing on the way..
I notice some programs like poser, makehuman, turbosquid free characters can export characters with 'bones'... How do you apply a bvh to bones? Do the bones need to be set up in some specific way? Do you load the bones and load the bvh file and somehow map them together?? I know 3dsmax bipeds are more ready for .bip files and .bvh but nothing exports in that format.. so unless I am creating it from scratch it seems I need to find a way to get these bones to work with bvh files...
What about Biped and CAT objects? When I export ythose as a FBX file can I use the with the 'skinned animation' XNA sample? Or must it be 3dsmax 'bones' ?
I tried Poser but when I got from .DAE -> 3ds max -> fbx -> 'skinned animation' the geometry is all messed up for some reason... but the nice thing about poser is the ease I can add bvh files plus I can map a face photo and easily texture the face...
Morph target possible in XNA? I don't think so.. So I guess the easiest way to lip sync is create a bone in the mouth and programmatically move it during audio playback ?
Any other tools out there that would be helpful or samples ?
I've never had any experience with what you're trying to attain, but I did come across this extensive thread on the AppHub forums about facial animation and morph targets:
http://forums.create.msdn.com/forums/t/32219.aspx
Here's an interesting quote from Jon Watte:
The XNA Model content format does not
support morph targets. The X file
format does not support morph targets.
The XNA importer for FBX and X
geometry does not support morph
targets. Thus, anything you do will
have to be custom at some level.
Thread goes on for 75 posts, so hopefully you'll find something of interest in there ... good luck!

Categories

Resources