Jump to content

making a collision mesh for a weird part


Recommended Posts

So yesterday i made a cargo bay. When i use the mesh collider on the component without the doors, when i check convex, it makes the whole cylinder have collision. When i import the part into KSP, when i put something in the cargo bay, i can't access it anymore because there's a collision mesh on top of the doors. Is there any way to just make the base part collide?

Link to comment
Share on other sites

Hi again:)  What you're going to need to do is create a convex hull, this is a group of colliders arranged to provide an open space. Without a reference image I can't tell what you've got,  this then is based on a simple box with doors on the end.  

Modelling app version  Step 1 clone your cargo bay less the doors( don't move it)  Next hide the original model and doors . Now you will need to divide your cloned object into 5 parts, left wall, right wall, base. top, and back, unhide everything and make these objects a child of the main model  and export as normal.  In unity you apply a convex mesh collider to all these clone collider parts and remove the mesh renderer component. 

Unity only version,  create a new gameobject align it with 1 of the walls etc, assign a box collider to that game object and adjust dimensions to suit, continue doing this until you've done all 5 faces

Link to comment
Share on other sites

1 minute ago, SpannerMonkey(smce) said:

Hi again:)  What you're going to need to do is create a convex hull, this is a group of colliders arranged to provide an open space. Without a reference image I can't tell what you've got,  this then is based on a simple box with doors on the end.  

Modelling app version  Step 1 clone your cargo bay less the doors( don't move it)  Next hide the original model and doors . Now you will need to divide your cloned object into 5 parts, left wall, right wall, base. top, and back, unhide everything and make these objects a child of the main model  and export as normal.  In unity you apply a convex mesh collider to all these clone collider parts and remove the mesh renderer component. 

Unity only version,  create a new gameobject align it with 1 of the walls etc, assign a box collider to that game object and adjust dimensions to suit, continue doing this until you've done all 5 faces

So this is what i want

http://prntscr.com/mlly3u

And this is waht i get :D

http://prntscr.com/mllyc9

Link to comment
Share on other sites

1 minute ago, SpannerMonkey(smce) said:

Yup thats expected, how did you get the top image and why cant  you use that

 

the top image is without selecting "convex" in the mesh collider component. When i tried writing the part without the convex enabled, it just acted the same as of it was enabled.

 

2 minutes ago, SpannerMonkey(smce) said:

Yup thats expected, how did you get the top image and why cant  you use that

 

By the way, could you check out my latest post? It's more specific compared to this.

Link to comment
Share on other sites

Hmm, well you'll have to make a set of colliders then, doing it in the modelling app is going to be easier as lining up game objects on cylindrical stuff for box colliders is no fun and time consuming.

You'll have to decide if you can live with parts hovering above the surface when attached, only in relation to the endcaps though, as a convex collider placed over the whole endcap will bridge the taper out to the end of that cylindrical extrusion .  If you can bear the odd hovering part you can do the end caps in one collider each, if you cant bear it, you'll have to make them in two colliders,  Then just decide how many faces you want to have in each of the wall colliders, difficult to say but 5 looks about right from your image, which will still allow plenty of clearance inside

roughly abused your image as i couldn't find an easy to view unity ref image in my collection, each color roughly represents an individual collider https://i.imgur.com/xYBgYMZ.png

Link to comment
Share on other sites

Just now, SpannerMonkey(smce) said:

Hmm, well you'll have to make a set of colliders then, doing it in the modelling app is going to be easier as lining up game objects on cylindrical stuff for box colliders is no fun and time consuming.

You'll have to decide if you can live with parts hovering above the surface when attached, only in relation to the endcaps though, as a convex collider placed over the whole endcap will bridge the taper out to the end of that cylindrical extrusion .  If you can bear the odd hovering part you can do the end caps in one collider each, if you cant bear it, you'll have to make them in two colliders,  Then just decide how many faces you want to have in each of the wall colliders, difficult to say but 5 looks about right from your image, which will still allow plenty of clearance inside

roughly abused your image as i couldn't find an easy to view unity ref image in my collection, each color roughly represents an individual collider https://i.imgur.com/xYBgYMZ.png

I roughly get the idea your explaining. I'll basically make each object in blender separate (Bot, Top, walls etc.) I'll also be going through your explanations over and over again. Thanks for all of your responses as they've been helpful every time :)

Link to comment
Share on other sites

1 minute ago, KerboNerd said:

I roughly get the idea your explaining. I'll basically make each object in blender separate (Bot, Top, walls etc.) I'll also be going through your explanations over and over again. Thanks for all of your responses as they've been helpful every time :)

Don't be tempted to split the actual model and use that to carry the colliders, it plays havoc with the smoothing, and once all the parts are separate its all too easy to nudge one slightly in unity and end up with a gappy model.  Always (imo) clone and cut the clone (and don't worry about how many colliders you have, some of my full size ship hulls with internal spaces have 30 or more)

Link to comment
Share on other sites

1 minute ago, SpannerMonkey(smce) said:

Don't be tempted to split the actual model and use that to carry the colliders, it plays havoc with the smoothing, and once all the parts are separate its all too easy to nudge one slightly in unity and end up with a gappy model.  Always (imo) clone and cut the clone (and don't worry about how many colliders you have, some of my full size ship hulls with internal spaces have 30 or more)

Oh! Ok! Will do! By the way, big fan of your mods :)

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...