Jump to content

Compilation of modding information links for 0.19/20/21/22/23 - Last update 24th Jan


hoojiwana

Recommended Posts

Hey guys, I'm busting my head with mesh colliders - I made one for my module but I think what I've done is actually a workaround - I made a lower poly mesh of the module, added it to unity, gave it a mesh collider and removed it's render properties, thus giving the module a collider that doesn't render, but as far as I know, there's a way to add a normal mesh, except I have no idea how. I tried naming it node_collider but that had no effect, I read it has to be tagged, but tagged how? I'm sorry, I'm sure this stuff is basic for people versed in Unity, but I'm utterly lost...

If anyone could help me with a step-by-step tutorial, I'd appreciate it ALOT.png

The name of your object in Unity doesn't matter. You need to add whatever mesh you're wanting to use and then 'Add Component' -> Physics -> Mesh Collider -> Check the 'Convex' box. If you aren't pleased with the accuracy of the result, you'll probably need to break it into several objects.

As for rendering the object (Seriously, someone tell me how to do this better because I've been asking) KSP will still render your object even if you uncheck 'Mesh Render' So I just create a KSP/Alpha/Translucent material with a totally blank texture.

This will give your KSP part an invisible collision mesh. I'm 100% certain that there's a better way to do this, but I'm not smart enough to figure it out.

Link to comment
Share on other sites

The name of your object in Unity doesn't matter. You need to add whatever mesh you're wanting to use and then 'Add Component' -> Physics -> Mesh Collider -> Check the 'Convex' box. If you aren't pleased with the accuracy of the result, you'll probably need to break it into several objects.

As for rendering the object (Seriously, someone tell me how to do this better because I've been asking) KSP will still render your object even if you uncheck 'Mesh Render' So I just create a KSP/Alpha/Translucent material with a totally blank texture.

This will give your KSP part an invisible collision mesh. I'm 100% certain that there's a better way to do this, but I'm not smart enough to figure it out.

Thanks! As far as the rendering goes, I right clicked on mesh renderer, selected Remove Component and that seemed to do the trick - the collision mesh is not visible even though it's not set to be transparent.

Link to comment
Share on other sites

So can someone please explain (nicely) why, when the mod already works fine straight from blender, I need to involve yet another program, seemingly for no reason? I know there must be an answer to this question but so far people just tell me "thats just how its done now" without actually explaining why.

presumably MU is better than dae in some way?

If you want to make use of the updated part modules that almost all of the stock parts use then you will need to set them up in Unity. Things like engines, RCS, fairings, solar panels, wheels, lights etc. all need to be set up in Unity and then exported with Part Tools.

Somebody (I forget who) was working on a plugin for Blender that allows you to export mu files straight from that, but I never tried it out myself.

The name of your object in Unity doesn't matter. You need to add whatever mesh you're wanting to use and then 'Add Component' -> Physics -> Mesh Collider -> Check the 'Convex' box. If you aren't pleased with the accuracy of the result, you'll probably need to break it into several objects.

This will give your KSP part an invisible collision mesh. I'm 100% certain that there's a better way to do this, but I'm not smart enough to figure it out.

You can change the mesh that a Mesh Collider will use. In the image below, where it says "resistocollider" that is a custom mesh for one of my parts. The mesh collider component is still on the 3D model, I just changed the mesh it uses to a simple 12 sided cylinder rather than having Unity figure out a new one, or adding in a new object and fiddling with removing the mesh renderer.

H8TTUCc.png

Link to comment
Share on other sites

  • 3 weeks later...

well the 'foot' item is the transform, which must be pointed -Y as in the screen.

The wheelcollider is being used for the suspension - its the round one at the 'knee' joint.

The part I haven't quite figured out yet is which names are required ones for the actual piston rod and sleeve. I think the use of capsule colliders is unrelated to the actual leg functions - they could still be mesh colliders I think.

Link to comment
Share on other sites

Have there been any changes to the way the MODEL{} call works in 0.22 as some parts/part.cfg's previously working under 0.21 using the MODEL{} call are now not behaving as expected (other radial parts fall off them, launch clamps don't 'clamp' to them, engines fall of tanks etc). It seems very inconsistent?

Link to comment
Share on other sites

No changes listed or observed - there is some hope about the scaling issues being fixed going forward.

I read about the issue in the Kosmos thread, decided to look at the part's config. It was frightening.

Here's the model{} node section: http://pastebin.com/Lc7hcTUP

I lost count of how many different meshes are being put together there. I can't imagine how collision is working in that instance, but I am pretty sure that collider interaction is causing phantom forces when the physics resume on the pad, and you never know what magnitude those will be - certainly easy enough to exceed the clamps breakingTorque threshold. The clamp itself also has some issues with radial attaching, I sometimes have to drop it and pick it up again to attach it, and it clips into some tanks. I know C7 adjusted a few stock tank colliders, its possible he adjusted the clamp too but he never mentioned it.

Also, during some MODEL and ATTACH discussion with a dev, we were informed that those functions are actually still unsupported; Squad doesn't use them for their own parts yet and they're not exactly finished. So they are sort of "use as your own risk" in any event, and using like 30 model calls in one part - thats highly likely to go awry.

Not really sure what to tell you on a fix. I don't THINK its a stealth change - I think its something you'll have to work around on your model's end.

Link to comment
Share on other sites

Yeah putting those .cfg's together was, uhh, interesting at first but after you get in the flow of it, it wasn't so bad. Most stuff doesn't have collision meshes, and there are larger (3x) segments to further reduce the number of parts/colliders per part as well, the largest tank had 11 collision meshes in the end I think? I made some really huge ones to see if it would break the game and, well lets just say you didn't want to use them with high symmetry, but they didn't seem to cause issues otherwise.

Just seemed odd that the URM system was working well under 0.21, but now it's misbehaving, but I guess if the MODEL{} call isn't finished/supported yet there isn't much that can be done while it's developing.

That reminds me, I should check my own parts which use MODEL{} as well.

[Edit] I don't suppose there is a (hopeful) implementation timeline on the MODEL{} and NODE{} systems?

Edited by NoMrBond
Link to comment
Share on other sites

Okay, I've been running into stack node funkery now and again, specifically with parts becoming unable to attach when you have nodes that attach in different directions (up and down, left and right, or front/back)

It seems that the node that acts as your parent (the one that will attach to others) must be the last node in your config.

Take the stock 6-way hub for instance:


//X-axis nodes
node_stack_right = 0.9121535, 0, 0, [B]-1[/B], 0, 0, 1
node_stack_left = -0.9121535, 0, 0, [B]1[/B], 0, 0, 1

//Z-axis nodes
node_stack_back = 0, 0, 0.9121535, 0, 0, [B]-1[/B], 1
node_stack_front = 0, 0, -0.9121535, 0, 0, [B] 1[/B], 1

//Y-axis nodes
node_stack_top = 0, 0.9121535, 0, 0, [B]-1[/B], 0, 1
node_stack_bottom = 0,-0.9121535, 0, 0, [B]1[/B], 0, 1

So since the Y-axis nodes are last, the hub must be attached to top or bottom first. If the order was changed, then those nodes won't attach anymore.

I know there are more rules to this because I can vaguely remember something about them, but they seem to be wholly undocumented.

Link to comment
Share on other sites

Reposting the 'custom sound setup' info that Faark discovered and nothke demonstrated

HOW TO MAKE YOUR OWN SOUNDS:

Since the 0.20 version folder structure, many have thought that adding custom sounds is not possible. The thing is, it just was never documented. Thanks to Faark I found out how to do that.

Make a sound sample file in .wav or .ogg format (bitrate and frequency I THINK don't matter much but the standard is 48000 HZ, 16bit) and it MUST be named with "sound_" in front, for example "sound_srb.wav" (in my case).

You need to make folders part/Sounds in your part folder, IN YOUR PART FOLDER, another "part" yes.. Confusing, but here's how it should look like:

GameData/ModName/Parts/PartName/part/Sounds/sound_XXX.wav

(XXX is your sound's name obviously) Awkward and very space wasting to put another part folder, but it is the only way it works for now. This is something that devs should correct in the future.

In the config file (.cfg) of the part add:

sound_XXX = action

where "action" is something like "running" or "engage" or "flameout", refer to other .cfg-s for more actions. Make sure NOT TO PUT THE EXTENSION such as ".wav" in the config file otherwise, it won't work.

Furthermore, there is a reason the folder in your part folder is named 'part' - it must match the name of your config file (which is usually part.cfg.

GameData/ModName/Parts/PartName/part.cfg

GameData/ModName/Parts/PartName/part/Sounds/sound_XXX.wav

So if you have a 'combined' parts folder with more than one part cfg, you need a folder per config file currently (which makes sense, if you have ever looked at the output log during part loading, you'll see that in the game database, the config file acts as a sort of "subdirectory" for each part:

GameData/ModName/Parts/PartName/part/YourPartName (from part.cfg)

GameData/ModName/Parts/PartName/part1/Your2ndPartName (from part1.cfg)

So to use a sound for each part, you will sadly need a separate folder and sound file for each:

GameData/ModName/Parts/PartName/part.cfg

GameData/ModName/Parts/PartName/part/Sounds/sound_XXX.wav

GameData/ModName/Parts/PartName/part1.cfg

GameData/ModName/Parts/PartName/part1/Sounds/sound_XXX.wav

Even if its the same file. Unfortunate, but at least it should work.

I passed along the info to a dev, and hopefully they can tweak it in a future update.

Link to comment
Share on other sites

Alright, I'll drop this here in case someone else ever needs to do this.

When I asked no one really knew how to add a part with a custom PartModule to the staging list. The secret was this:

namespace module
{
public class YourModule : PartModule
{
public override void OnStart(PartModule.StartState state)
{
this.part.stagingIcon = "PARACHUTES";
}
}
}

Here, when you load the part in the editor, the part would be assigned the stock Parachute icon. That's all you need to do and the icon will appear/disappear properly. Here's the list of the stock strings for icons:

  • ADV_SAS
  • COMMAND_POD
  • CUSTOM
  • DECOUPLER_HOR
  • DECOUPLER_VERT
  • FUEL_LINE
  • FUEL_TANK
  • LANDING_GEAR
  • LANDING_LEG
  • LIQUID_ENGINE
  • MYSTERY_PART
  • PARACHUTES
  • PROBE
  • RCS_MODULE
  • RCS_TANK
  • REACTION_WHEEL
  • SAS
  • SCIENCE_GENERIC
  • SOLID_BOOSTER
  • STRUT
  • STRUT_CONNECTOR
  • WHEEL
  • WINGLETS

As for what concerns adding a completely custom icon you made yourself, I tried myself but haven't got it to work. The information on the WIKI is extremely outdated and I can get it to work. If someone has more insight on that, feel free to add it.

Link to comment
Share on other sites

  • 2 weeks later...

I've got a quick question about landing legs. How do you get them to animate smoothly while retracting? I got mine to work just fine when extending but when I go to retract them they "snap" instantly back to the start of the animation.

*edit*

I understand that the animation must be played in reverse and, obviously, I have missed a step. What is that step?

Edited by Absolution
Link to comment
Share on other sites

  • 3 weeks later...

Ok, I admit I am a total C# and Unity Noob.

Nevertheless I have access to the latest version of C# source code on GitHub and also freshly downloaded the free version of MS Visual C# Express.

But it seems I am missing files from Unity to be able to compile that.

How exactly do I set my system up?

Where do I get the relating Unity cs files from? (Maybe I need the KSP versions...).

Anyway I would be very thankful if someone would turn my question marks, which are currently flying around my head, into exclamation marks.

edit: Unity is already installed.

edit 2: wanted to upgrade to the latest version but unity seems to have a problem. I only receive a blank page.

Edited by Bizz Keryear
Link to comment
Share on other sites

What version of Unity is it? at least 4.x?

You'll need to load the kSP Part tools into Unity, it has documentation inside of it to get you started with the C# documentation:

http://forum.kerbalspaceprogram.com/threads/34013-0-20-PartTools-GameDatabase-and-new-features

Ediit: it contains a DLL you load into VisualStudio or MonoDevelop (another C# development program, which is free and usually installed along with Unity itself)

Edited by Tiberion
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
-snip-

Alright, going to update the information here.

Starting from 0.23 and on we can use EFFECTS nodes for this. That allows us to store only one sound folder anyone in the GameDatabase folder and use it for any part we want without having to copy it.

However, it does require to have a plugin allowing it.

All what you need to do is to add

this.part.Effect("MyEffectName");

in your plugin at the relevent areas. Then you simply need to insert such a node in your part config file:

EFFECTS
{
MyEffectName
{
AUDIO
{
clip = ***string url of the clip here***
volume = 1
}
}
}

You can store multiple effects names in one EFFECTS node, as well as have multiple effects per effect names.

Apart from Audio, there are multiple effects that can be used, including particle effects. They can easily be found using the effects browser of VS, and accessing their different components is also possible. For AUDIO nodes, it's also possible to adjust pitch, for example.

Thought I might as well drop this info here since anyone has yet to do it.

Link to comment
Share on other sites

I just finished this hoojiwanna - in case you want to add it to the OP for plugins, if not thats cool too :)

but just in case you hadn't seen it - http://forum.kerbalspaceprogram.com/threads/66503-KSP-Plugin-Framework-Plugin-Examples-and-Structure-v1-0

TaranisElsu also did a bunch of good quickstart examples here as well - http://forum.kerbalspaceprogram.com/threads/56053-Example-plugin-projects-to-help-you-get-started

Link to comment
Share on other sites

Firstly Thanks hoojiwana for having a detailed and current list here on the forums.

I installed Unity 4.3.3f(latest at printing) but had some issues with animation and emissive textures.

Specifically i could import blender animations and animate part in game, but any animation created in unity would not work in game.

here is a sample of the KSP.log:


[LOG 13:02:39.070] Load(Model): domelight/model
[ERR 13:02:39.072] File error:
(null)
at (wrapper managed-to-native) UnityEngine.AnimationClip:SetCurve (string,System.Type,string,UnityEngine.AnimationCurve)
at A..ReadAnimation (System.IO.BinaryReader br, UnityEngine.GameObject o) [0x00000] in <filename unknown>:0
at A..ReadChild (System.IO.BinaryReader br, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at A.. (.UrlFile ) [0x00000] in <filename unknown>:0
[WRN 13:02:39.077] Model load error in 'E:\Games\Kerbal Space Program 22.0 - Copy\KSP_win\GameData\domelight\model.mu'

The fault seams to be in the way part tools writes the .mu file or the way KSP Loads it.

After trawling this forum and trying numerous combinations in hierarchy and import settings i found a thread that covered the issue i was experiencing:

http://forum.kerbalspaceprogram.com/threads/25023-Emissive-tutorial?p=921862&viewfull=1#post921862

If you have a chance it would be good to have a note under the 'UNITY/CONFIGS Animation' title for people using unity based animations or emissive textures to use 4.2.x versions.

I now have Emissive textures animating in unity 4.2.0 with part tools .23 (blender 2.69)

hope this helps.

Link to comment
Share on other sites

Has anyone had any luck with animations (or emissives) under Unity 4.3.x or is there still no resolution for this?

I don't want to roll back to Unity 4.2.2 and re-create every scene for my whole project just to make these work

Link to comment
Share on other sites

I did a set of screenshots of my Tiberdyne wheel, its not a complete breakdown of everything in the part, just the major parts that are "functional" - the rest is just standard animation.

Expanding on this just a bit: the first frame of the animation has to be the deployed state, the last is retracted. Animation name can be set in the config.

If name is not required, either name it exactly as shown above (names are case sensitive) or define it in the config. If the wheel pretends to be doing ballet, define wheelRotationAxis in config.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...