Jump to content

Sketchup>Blender>Unity>KSP Issues. In-Depth Advice Request


Recommended Posts

I have been working on a new part for KSP for about a week now. Last week was spent writing the plugin, which works flawlessly. However, developing it was done by copying over the stock accelerometer part and editting its config, just for testing. I have spent the past 2 days modelling the new part in sketchup and finalizing in Blender. I now have a blender file (.blend) fully textured and cannot figure out for the life of me what to do now. Some tutorials say you need a collider object in blender, some don't create one until unity. On top of that, this mod is going to be submitted as a final project for my computer science course, and I will be documenting the entire process in a technical report. As a result, while helping through replies on the forums is great, I need to actually have a conversation with someone who will walk me through the process, with screen-sharing and the whole lot, so that I really get a feel for each and every step. Anyone willing to video chat with me to help me finish, just private message me.

Link to comment
Share on other sites

what shape is the object? if it's a simple shape like a sphere, cube, or something. use Unity primitive collider. info here (disregard the bit about "rigidbodies", not applicable to KSP.)

or this

you'll have better chance of getting help with specific questions than asking for someone to walk you through the entire process.

Link to comment
Share on other sites

what shape is the object? if it's a simple shape like a sphere, cube, or something. use Unity primitive collider. info here (disregard the bit about "rigidbodies", not applicable to KSP.)
or this

you'll have better chance of getting help with specific questions than asking for someone to walk you through the entire process.

will definitely check it out. thanks for the rapid reply. I was actually hoping you'd see this, your work is quite impressive. its a cylindrical shell with another cylinder on the side (its a wristwatch for your rocket, because the plugin adds a real-time clock window) but i think the collider only really has to cover the band, the parts of the watchface that extend past the band don't need to be collidable, i don't think. As such I was attempting to use a simple cylindrical mesh as a collider. so the blender file should only be the part, with no other mesh? and how do i go about installing part tools. which version, in what order, where? i've seen a couple different sets of instructions.

Link to comment
Share on other sites

PartTools stuff here. http://forum.kerbalspaceprogram.com/threads/102334-Unity-to-KSP?p=1585664&viewfull=1#post1585664

okay I see. the collider setup will depend a lot on how the part attaches, and whether it needs to be pass through. if it's stack attach, then a simple disc shaped mesh collider should work best. if it has to be a pass through, a ring of ~8 flat unity box colliders will work to approximate the ring shape if it's 1.25 to 2.5m diameter. Really depends on how accurate you want to approximate the tube's inside and how big the tube is.

if you use convex mesh collider, then you need to create another mesh in Blender (details on how it should be is in the later half of the Unity video). the collider mesh should be as low tri-count as possible (maximum of 255 triangles per convex mesh collider, less the better), enough to approximate the shape of the part. You can compound them for more accurate approximation, but will have frame rate costs. Export the part mesh and collider mesh together into into Unity, add mesh collider to the collision mesh you made in Blender, check "Convex". There you can copy/paste the mesh collider component (right click on it in inspector) to the actual part mesh if you only have one collision mesh for the part (Unity allows 1 collider component per game object), then delete the collider object from the scene. or you can remove the mesh filter and mesh renderer components of the collider object so it is invisible in KSP.

Link to comment
Share on other sites

PartTools stuff here. http://forum.kerbalspaceprogram.com/threads/102334-Unity-to-KSP?p=1585664&viewfull=1#post1585664

okay I see. the collider setup will depend a lot on how the part attaches, and whether it needs to be pass through. if it's stack attach, then a simple disc shaped mesh collider should work best. if it has to be a pass through, a ring of ~8 flat unity box colliders will work to approximate the ring shape if it's 1.25 to 2.5m diameter. Really depends on how accurate you want to approximate the tube's inside and how big the tube is.

if you use convex mesh collider, then you need to create another mesh in Blender (details on how it should be is in the later half of the Unity video). the collider mesh should be as low tri-count as possible (maximum of 255 triangles per convex mesh collider, less the better), enough to approximate the shape of the part. You can compound them for more accurate approximation, but will have frame rate costs. Export the part mesh and collider mesh together into into Unity, add mesh collider to the collision mesh you made in Blender, check "Convex". There you can copy/paste the mesh collider component (right click on it in inspector) to the actual part mesh if you only have one collision mesh for the part (Unity allows 1 collider component per game object), then delete the collider object from the scene. or you can remove the mesh filter and mesh renderer components of the collider object so it is invisible in KSP.

I was under the impression that convex colliders were mandatory? are they not? or are you saying thats what i must do if i want to use a mesh collider?

thanks again for all your help

Link to comment
Share on other sites

convex mesh collider is not mandatory. Unity's primitive colliders (Box, Sphere, Capsule) are always preferable as they are the cheapest to compute. convex mesh colliders should be only used when absolutely necessary, they are the most expensive on the physics engine. nearly all the parts that you would reasonably expect in KSP can be covered using compound primitive colliders, it just takes a bit more time to set up.

Edited by nli2work
Link to comment
Share on other sites

convex collider is not mandatory. Unity's primitive colliders are always preferable as they are the cheapest to compute. convex mesh colliders should be only used when absolutely necessary, they are the most expensive on the physics engine.

well then as it is my very first part and only ever going to be used in a stack (it is a wristwatch after all) i guess i can safely make it a basic disc collider. So to recap the steps are:

1. Open Completed blender object, which has only the part, no secondary mesh for the collider, make sure it looks correct, save it, close blender.

2. Open Unity, create new project, make sure part tools is installed correctly.

3. Import blender file (does it have to be exported or can i use the .blend? and if it does have to be exported what file type is best? fyi there are no animations)

4. Add simple cylinder collider, resize to part.

5. No clue what to do now.

I know there are intermediate steps but i am fuzzy on them, clarification would be much appreciated.

Link to comment
Share on other sites

step 3. you can drag/drop a blend file. Unity will convert it to FBX automatically. if something goes wrong, try exporting to OBJ or DAE.

step 4. that's the rub. :D there's no cylinder primitive collider in Unity. you have to do with either a capsule (which is a sphere when you try to approximate a disc); or a series of box colliders; or a convex mesh collider using a cylinderical mesh.

step 5:

(if you sit through about 1st half of that video, it'll answer most of your questions about getting something into the game. the info is spread out since the main focus is IVA, but all parts in KSP follow the same general process whether it's IVA, Part, or Prop)

Nifty255's video on exporting a part is more concise and to the point here

Edited by nli2work
Link to comment
Share on other sites

ok so here's what I have right now:

0gJWP8v.png

that big tube is going to be the collider. now i open unity, install part tools, select the big "collider" object, add a convex mesh, copy that mesh, delete the object, and paste the mesh as the watch's collider. right?

Link to comment
Share on other sites

Look at it this way. Unity objects are generic objects, you change their behavior by attaching Components (Mesh Filter; Mesh Renderer; Collider; etc). All Unity Objects have the Transform Component (the bare minimum for a 3d object). If you want to create a visible mesh, you add Mesh Filter (so the Unity Object knows which mesh to find) and a Mesh Renderer (so the Object gets rendered on screen by Unity). if you want a light, you add the Light Component. If you want a Camera, you add the Camera Component. etc etc. You can copy/paste Components between different objects, by right clicking on a component and selecting the options in the menu that comes up, just like most standard Windows operations.

In this case, you want the watch part to be visible (So you need a Mesh Filter; and a Mesh Renderer); you want it to be selectable in KSP (so you need a Collider). As far as KSP is concerned, Collider and Mesh don't have to be on the same Unity Object; they can be on the same Unity Object, but doesn't have to be. As long as an Object (there can be many objects) in the exported MU has a collider, you can select it in KSP. So you have couple different ways of doing this,

you can use a separate Unity Object just for the collider component: you import your blend file, apply mesh collider component to the collider mesh you made, check "convex", and you see green outline around the mesh. Then you remove the Mesh Filter and Mesh Renderer (since you don't want the mesh collider to be visible as the same time as your object mesh).

or you can put all the components on one Unity Object (since you only have 1 collider to deal with): All the steps are the same, after you get the green outline, copy the Mesh Collider Component from the collider mesh you made, and "Paste Component as New" on the part mesh. then your clock mesh will have Mesh Filter; Mesh Renderer; Mesh Collider component. you clock mesh will show a green outline indicating the collision mesh boundries.

when you click "Convex" the holes will be capped to make the mesh convex. just think of as an object with no indents.

different ways to do the same thing.

Edited by nli2work
Link to comment
Share on other sites

no. you have to approximate it with other colliders. The hole will be visible all the same, it's only that as far as the physics engine is concerned, the object is a disc.

i can live with that. thanks again

UPDATE: So I have this now:

Javascript is disabled. View full album

what next?

Edited by gkorgood
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...