Jump to content

Few question for my welding tool (include IO, Part, Model)


Recommended Posts

Hey all,

I have decided to work a bit on my welding tool to make it in game tool.

I have a good programming background even if I didn't touch a code line for 4 years (a bit rusty) and this is my first C# experience (I do know C++)

I will be updating the questions I have, It will mostly be how I can access some data (which class to look for)

Here are the first few questions:

- The only way I have found to write the file in Gamedata/UbiozurWeldingLtd/Parts/Category is by using ConfigNode class. It does work as a charm, except that of course the file does not work, and I don't know how to check if it already exist and/or create it? also is there a way to have the plugin folder from a variable? I don't really like hardcoding the plugin forlder in it.

Fixed using System.IO

- So the part.cfg file will include the model with the node MODEL{ }, where can I find the path of the path of the mesh to use?

Done with a nice use of regex and the database.

- I can add the nodes when I weld two parts together, however I haven't found a way to get the position of the new node. or the position of the second part. I have looked at all the position and original position value without success. I will also need to know that position/rotation value for the MODEL{} stated above.

Thanks for your help.

Any point toward the class I have to look for or a plugin that already does it would be appreciated.

I have looked at the subassembly manager to know how to setup the project so far.

Also if there is actually a way to save a Part class to a file directly, it would be even better (if I can choose the save directory)

Edited by UbioZur
Link to comment
Share on other sites

apparently I am not the only one not knowing how to do it.

I have fixed the writing of the .cfg using the System.IO

I have still not found a way to access the GameDatabase for the MODEL and so any link from the part name and the url stored by the database.

Also not found a way to access the relative transform of the part from it's parent part.

Link to comment
Share on other sites

Actually, I thought Nexis banned assemblies referencing System.IO way back in .18 from loading. Is that no longer true, or was it another assembly that was banned? I just realized the old sticky about the PartModule Incident isn't around any more also, unless I'm in the wrong forum somehow.

As far as getting a relative transform, there may be something in Unity I'm unaware of, but you could get the (world) transform of the part itself, then take a reference to the parent, get it's (world) transform, subtract, and end up with the relative transform, though it would also include any physics warping from the engine. If you can get ahold of the values from whatever is holding vessel prototypes nowadays, you could derive the un-warped values.

Link to comment
Share on other sites

I confirm it's been unbanned. and luckyly for me, it was the only way I could choose where to get.

I will have a look at that world transform kelven.

I have finally (with a massive help from a friend) been able to grab the url. I have now a part.cfg writer in game. As I finish the basic of the UI and transform, I will add all the ressources/fx/module/crew etc...

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...