Sometime we need to show data in rows that saved in different columns. For that purpose we can use two relational operators UNPIVOT and PIVOT to convert data into rows from columns and vice versa. Appendix A - Delphi I/O Errors. Thanks goes out to Erik Martin for posting these Delphi IO errors on his web site. The following are the Windows API (and former DOS) IO errors, which are also the IO errors often returned by Delphi programs, and which are generally difficult to find reference for, and are especially difficult to find referenced as Delphi errors.
Hey guys, I'm new here and was upset about the fact that there is no vertex modeling - so some friendly folks led me to listener's older post about a Point Cache Reader script that would allow me to use my vertex modeling.To give a short point of what I'm making, I have a ship (Like the 1800's style ones), and it has sails. The sails would be difficult at best to bone-animate, and as you know Unity has no native vertex modeling capabilities, so 3DS Max's wind simulations don't carry over.Alright then to the problem.On, someone modified his script to close the filestream at the end, to avoid the Sharing Violation error. However, I'm using this script on multiple sails and it gives me the sharing violation error. Not sure how to avoid that.In addition, the single sail that doesn't have the sharing violation error (being the initial sail) has a different error:'EndOfStreamException: Failed to read past end of stream.System.IO.BinaryReader.FillBuffer (Int32 numBytes)System.IO.BinaryReader.ReadSingle PointCacheReader.ParsePCFile (at Assets/CacheFile/PointCacheReader.cs:251)PointCacheReader.Start (at Assets/CacheFile/PointCacheReader.cs:95)'I don't really do coding, I'm more animating and modeling, so I'm not really sure what this means to be honest.Thanks for your help! Okay the copy pasting worked great for the sharing violations, at least I can do something.I must have implemented your code wrong, I got this:Assets/CacheFile/PointCacheReader.cs(267,26): error CS0136: A local variable named `fs' cannot be declared in this scope because it would give a different meaning to `fs', which is already used in a `parent' scope to denote something elseI'm really sorry I'm like a monkey in a new world here. I put that code at the end, replacing fs.Close;Do I take out the extra 'fileParsed = true;' as well? That came right before the fs.Close;At least I'll be the most comedic troubleshooting case in your career.
Click to expand.So do you have the 3DSMax 2013 product update 2? That post mentioned it fixed something with the pc2 file saving. Did it solve the EndOfStreamException error?Try this version. It just uses the 'using' keyword and adds a little try/catch statement to catch any exceptions and tell you what happened. You'll have to go back to using the same pc2 file for both sails to test if this works. (This is trying to solve the sharing violation error, not the EndOfStreamException error.)code deleted for the right final code, see. You can try this new version I made which no longer uses file streams and a string path.
Instead it uses a TextAsset file. So get your FILENAME.bytes file in Unity and drag it onto pointCacheFile and run it. There should no longer be file sharing issues when using the same file. Note: I didn't test this as I don't have a mesh and pc2 file to play with.Also I read in the thread that its very important your model in 3DSMax and in Unity have exactly the same number of verts. You might want to make sure Unity didn't do any optimization on your mesh.
Look at the mesh asset in the inspector and it will tell you how many verts it has.Edit: Made a tiny code change.code deleted for the right final code, see. @Dressman - Make sure you have the updates to 3DS Max mentioned above, they were saving pc2 files with 64 bit ints instead of 32 bit ints in their pc2 files that is fixed with the updates. Also as guavaman says for the script you are using you will need to make sure you have the exact same vertex counts in your max mesh as the unity mesh and that the Unity exporter doesn't reorder anything such tri order or optimize out any vertices.
And if your meshhas an kind fo smoothing groups or fancy uv's then Unity will change your mesh on import and the point cache script will fail. The script you are using is nice handy free system but it can break very easily. Click to expand.As for this, my sails seem to go by a case-by-case basis.
Some of them are exactly the same in vertices, while others have different amounts. Curious.My run-of-the-mill sails have a steady 20 vertices, in both Max and Unity. However, the more uniquely or complexly shaped ones have many more vertices in Unity than Max.
The front sail has 11 verts in Max, with 33 in Unity; while the back sail has the normal 20 vertices in Max but a whopping 78 in Unity. I'm assuming it's Unity's automatic importation that changes them so radically based on their various forms.I'm not exactly sure how to adjust that, but worst case scenario the majority of the sails will move if the script is successful, lol.Thanks againEdit@above: I am currently updating from 1 5 (apparently I didn't even have 1 - either that or it gives no error when you try to re-install an update).As above, I reported my vert count for the models.
It's the same for some, but not for the more complexly-shaped sails. I don't think they use fancy UVs - they're pretty basic materials. Certainly not smoothing modifiers.Thanks for your contribution - I'll really have to find some time to learn C# so that I can diagnose these things without being a bother. Click to expand.You're not getting the EndOfStreamException because my script is quitting before even getting to the processing because you don't have a.bytes file attached to your monobehaviour. Click to expand.I have had problems with uv counts and verts in exported fbx files from Maya as well.
It was quite a nightmare trying to map vertex colors to my objects because of the discrepency. I never found a perfect solution. But in your case, check the manual on. Specifically, Mesh Compression, Mesh Optimization, and Normals (import). There may be others. Export your object from 3DSMax, reimport with various settings and see if you can get the verts to match. The animations will never work if the vert counts don't match perfectly.
Also, you could try exporting from 3DS in various other formats compatible with Unity and see if that helps. Also check your options in your FBX exporter and see if you can find any way to disable optimization, etc.I would also recommend checking your FBX in which might tell you whether the vertex optimization is happening in Unity or Max. Oh okay, sorry I thought that script was exclusively for Android/iPhone (mobile), not an updated version that included that.So, I ditched the other script and put the defined script in its place, and things make sense now. I got my.bytes file from Max, and renamed the PointCacheReader to PointCacheAndReader (since I had the error that my script was incorrectly named), and in inspector dragged and dropped the.bytes file into the Text Asset slot. Even though things seem to make sense on my side, I'm still getting errors. Okay, I re-exported a new.pc2, and saved it to my Assets as a.bytes, and it actually worked.
Re-exporting solved the streamexception with the new max updates.But, there's yet another problem instead. The sail is no longer connected to the boat at all, rather it seems to have stretched far across the screen like crazy, and warped massively, though it does have wind effects. I am also still getting the 'ZETZ' notification, not sure what that is.It's difficult to see anything, the sail is so insanely warped over the sky - I have no clue why that happened. Okay, I re-exported a new.pc2, and saved it to my Assets as a.bytes, and it actually worked. Re-exporting solved the streamexception with the new max updates.But, there's yet another problem instead. The sail is no longer connected to the boat at all, rather it seems to have stretched far across the screen like crazy, and warped massively, though it does have wind effects.
I am also still getting the 'ZETZ' notification, not sure what that is.It's difficult to see anything, the sail is so insanely warped over the sky - I have no clue why that happened. Ah-ha, I never noticed the WSM point cache modifier. I hope that's the issue. I will try it.I pose a question a bit off-topic though - you moved on to Maya why? Is it superior to 3DS Max? Like a program I should start using instead?
Or are they a matter of preference?Edit: I'm not sure if I will need WSM modifiers separately or all together either. I'm assuming separately since they should have differing world spaces (of course), but am hoping that I can stack it into one file. Trying it now.Edit#2: It seems trying to record the WSM modifiers all together confuses the program and it is unable - I will have to make a WSM.pc2 for each individual sail. Only thing now is.I'm not sure how to put both the WSM.bytes and the other.bytes in the same script. Click to expand.Half way through school my classes all started using Maya so I switched.
I just got used to the workflow.I can't really comment on the modern versions of max because I haven't even touched it since like v7. Back when I was using both, it was generally a matter of preference. Maya was always known for its ability as an animation program and for MEL script and the Maya API which made it a highly extensible platform.
Movie studios used it a lot because they built their whole pipeline around it because it was so extensible. (One of my teachers who worked at ILM at the time said they were using a version of Maya 3-4 versions behind the newest because they had SO much built on top of it and they couldn't break it in the middle of a project.) Max always had more game developer friendly features built in and tried to give a lot of impressive tools out of the box with every release. Over time Max also got scripting capabilities too though. I generally feel Max bundles more full-featured tools to help you do a wide variety specific things easily for various fields (stuff like all the automated bone character animation systems they include) where Maya still feels very programmer/engineer oriented and makes you do a lot of things manually (which can be a good thing sometimes because you're less limited, but it can also require a lot of extra work). I guess it's more like you have to bend it to your will where Max feels like a toolkit for artists. One example, I used Maya entirely as my level editor for my game. I wrote all kinds of tools in it to do various things such as define a path node grid, lay out various kinds of volume triggers, populate the level with props and export them to a binary format for import to my game, vertex light and export to game, etc.
Navigating and snapping objects seems easier in Maya than Unity to me, so I'm still using it as my level editor. Before I had a running prototype, I made a tool to allow me to walk my camera though my world with a simulated game camera view so I could get a preview of gameplay. Stuff like that.Again, I've barely kept up with the changes to Max, but when I do occasionally check out the new features I'm sometimes jealous as a Maya user because of all the neat new toys they keep adding all the time. If I really wanted the biggest tool box, I'd probably just use both. Ah, okay, makes sense. I suppose for now at least I'll stick with Max, since I'm not doing anything with movies or level editing - yet.I had put one PointCacheAndReader on each sail anyway - none of them are cloned.
What I mean is, there is only one cache file available to put in for the script. I have to use a cache file as well as a WSM cache file, according to listener.
It only shows one space to drag drop a cache file in inspector, to add the WSM cache files, I'd need two.Edit: I tried putting two PointCacheAndReader scripts on one sail, using the WSM cache file in one script, and the normal cache file in the other. Doesn't work. Also, when I only have the script with the WSM file, the sail vanishes.just disappears when you press play. Using the World Space point cache modifier is not a good idea as that will change the vertices depending on where your sail is when you export it, and when you load it into Unity the sail will get repositioned, you should use the local space version.
Also the data in the pc2 file will not have been subjected to the Unity scaling when a fbx file is imported so you will have to make sure your fbx import settings scale is 1 when you bring your fbx files in, if it is on the default of 0.01 then your sails will be 100 times bigger when you apply the point cache script. Ah, thanks SpookyCat.
Click to expand.Two things:. Why is your script file more than 136 lines long?
The error occurs on line 145, but the script file listener posted was only 136 lines. That makes it hard for us to debug it if you've modified it in any way. I found where the error is anyway (line 76). It would only ever happen if the mesh attached to the game object with your PointCacheAndReader has more vertices than are in the pc2 file. You should double check your mesh again that's attached to this object and make sure the vert counts match.
Do this for every sail and every PC2 file. And make sure you're not attaching the sail to the wrong pc2. Click to expand.Unity will never import anything from 3DSMax or any other modeling program except polygons, UVs, vertex lighting, normals, tangents, skin weights, transform animation, and materials with diffuse texture (I think that's all). Any modifiers or history on the object are ignored.
Its best practice to bake your model down and clear any history and transformation modification before exporting as well. (In Maya, you delete history and freeze transformations). I would think that would happen when it imports anyway, but it can't hurt to try.Also, it looks like according you have to have the pivot centered. You might want to try this on one sail only (no boat) just to see if you can get it working:. Center the pivot.
Move the sail to 0, 0, 0. Freeze/reset transformations.
Save the animation to a PC2 file. Clear history (get rid of any modifiers, animation, etc). Save the model file.
Import into Unity.If that works then you'll probably have to export each sail manually and reposition them on the ship in Unity.Also, how are you exporting your model? Do you just save it in the normal 3DStudio file format? Maybe you could try. Well that is strange, when I copy that code and paste it into MonoDevelop, it comes out to 271 lines. I didn't edit anything in the code.They both have 20 vertices, (I'm using EditPoly modifier to check the verts in Max, as I always do, assuming that's the way to do it). When I select all vertices in Max, it comes out to 20 (as the mesh has in Unity), but the wireframe in Unity has a lot more lines going diagonally, while Max's wireframe has absolutely no diagonal lines in the skeleton.I made a duplicate of the max model so I can mess with it without worrying about anything.
I'll try those steps you mentioned. Also, what do you mean exactly by 'center the pivot'? Get rid of any rotation - like - make planar?I'm currently exporting it directly to the Assets folder as a.FBX fileEdit: I think my script is counting all the spaces (enter key spaces) as their own lines. Click to expand.This makes it sound like you've still got a transform problem. If your object was at 0,0,0 on export, and your object in Unity is at 0,0,0 on import, the sail should be showing up at 0,0,0, not somewhere else.
So I have to assume your object still has unfrozen/not-reset transforms when you exported it or else it's not at world 0,0,0. Either that or perhaps its a scale issue.
Your PC2 might be exported for one scale and the object may be imported into Unity at another scale. Either way, it would be easiest to figure out if I could see the files. Click to expand.Yeah, then you're going to have to copy and modify a shader to be double sided. SeeOk, I already see one big problem. Your PC2 file is not being exported correctly.
Looking into the binary file, it only contains data for 11 vertices, yet your model has 20. This PC2 file won't work with this model. There has to be something wrong with the PC2 creation process.I compared it to data that woodn sent me in - his working flag had the proper 49 verts in the PC2 and 49 verts in the flag model.
I'm going to try to get a demo of max and see if I can find what the problem is with export. I opened the sail.max file but I don't see any vertex animation on it or any other modifiers except editable poly. I won't be able to export a PC2 from it unless I'm not understanding something. Also, I see you have keyframes on it for a boat bobbing up and down animation - you're going to have to remove these before you export the PC2 and the mesh.Your bobbing animation should only be on the boat body most likely.
You can then group the sails as children of the body in Unity so they'll bob too. You had told me to remove the modifiers from it before exporting so I did - lol.
I'll put them back and upload the.max file again.The keyframes were for the animation to work in Max, I didn't use Unity till like 2 days ago, so never planned on something like that. In all honesty, I don't really know how to remove keyframes, I'll try to find out how to bring up the timeline UI in Max.The attachment should now have the Point Cache modifier and vertex animation.Edit: Oh, I didn't put the colliding objects in that, so if you simulate the animation in Max it'll just blow away lol.Edit#2: I just found another post where someone said that all Particle shaders have two sides - I'm using one of those.
If I use one of those and the WSM cache file, everything works perfectly, except the sail is relocated when you press play. Otherwise, all the animations work. Oh goodness, I think it's working lol.I re-exported the.pc2 and it seems to work just fine now, I hope. I will try to import the whole boat now, and get all the sails (that have identical verts) to work.Edit: I figured out why there are only 11 verts on the old.pc2. It's because - ignorantly - I applied the modifiers and recorded the.pc2s all at once.
So I think it took the verts of my lowest vert-count sail, and tried to go with that. I think I can freeze the sails so I can do them one at a time.
Click to expand.Are you trying to export the whole boat at once? It would be a lot better if you exported each sail as a separate object. The boat itself can have the primary animation on it. (Use fbx, no need to OBJ for the body if you're not doing vertex animation.) In unity, you build your hierarchy of gameobjects with the boat body as the main parent.
Attach the sails and any other objects as children to the main parent and they'll follow along with the animation. This is pretty much standard practice in building complex objects in Unity.
It might help if you went through some Unity tutorials to familiarize yourself with how it all works. Yeah the sail I sent you, along with about half the others work fine cause the verts work fine. But Unity decides to 'fix' the other ones (I also fixed the one-sided issue now).I deleted all those keyframes on everything but the boat's hull, so they don't bob anymore; they're inanimate without the script. The problem is half the sails in my.fbx file are 20 (The sail models are unique because their sizes vary), but when I load that.fbx into Unity they become higher, like 23 or 26.I imported the.FBX into Max to make sure Max wasn't changing the verts, and they're the same. It's just when they go into Unity they change. Also, all the modifiers are deleted and replaced with 'Edit Mesh' in the.FBX, so that shouldn't be a problem.
At a bit of a loss to what to do with those.
Problem:I got wired issue today saying NQSError:61013 File error, There has been a sharing violationSolution:This problem came to me when I was developing repository object and I left it open for 2-3 days. And again when I started back after 3 days it was not allowing me to save changes which I done.Just open the RPD in online mode and make some changes in repository and save it. If you don't want to loose the change stop the server, save and then close the administrator, and start the server.