Jump to content

Help with Fuel Tank Mesh Collider


Recommended Posts

Okay so I saw a recent request for a "shell-like" fuel tank where the fuel is in the outer portion of a cylinder and then you put your second stage inside the hollow area.

I decided to try my hand at making it (my second part ever making in Blender). I finished the modelling and texturing (although it looks pretty bad) and I was ready to move onto the collision mesh, which I used Unity for.

If I used a Convex Mesh Collider, it would make the bottom of the fuel tank (the little lip) work perfectly fine but I couldn't put anything inside.

If I used a Concave Mesh Collider (by not checking the convex box), it would let me put my second stage inside but the whole fuel tank could fall through the terrain (because the little lip doesn't have a collider on it.

I'm looking for a way to make this mess collider in either Unity or Blender (if it's Blender, a little help on the export straight to KSP) so that I can put things inside of my fuel tank without it falling through Kerbin.

Any help is appreciated!

The Fuel Tank:

http://imgur.com/a/0TfhR

Link to comment
Share on other sites

kerbal only handles convex colliders correctly but those don't allow any holes or depressions (hence being called convex) the way this is handled by cargo bays and other existing hollow parts is to build the collider out of several separate smaller pieces. add too many and it eats processing power calculating the physics add to few and the inside of your hollow space will be very angular, and might not fit what you are trying to fit inside.

Link to comment
Share on other sites

kerbal only handles convex colliders correctly but those don't allow any holes or depressions (hence being called convex) the way this is handled by cargo bays and other existing hollow parts is to build the collider out of several separate smaller pieces. add too many and it eats processing power calculating the physics add to few and the inside of your hollow space will be very angular, and might not fit what you are trying to fit inside.

Any suggestions for how to solve my problem?

Link to comment
Share on other sites

But which two should I use? Ome for the inside, one for the outside? I've been playing around with it for awhile, I'm just not sure what exactly to do

No, you use many colliders - more than 2... at least 3 are needed to form a hollow shape.

If your cylinder is 24 sided, you would likely use 12, 16, 20, or 24 colliders (or more!), depending on how closely you want the collision shape to follow the actual tank shape. Essentially you would have one collider for each side/quad of the cylinder (more or less depending on how closely you want the shapes to match). These would be as tall as the cylinder, but thin enough to still allow proper room inside the cylinder.

So, intead of making a single collider in an O shape; you would make something like:


___
/ \
| |
\ ___ /

where each of the segments of the wall is its own collider.

(Sorry, at work at the moment, so cannot do any proper images).

Keep in mind that more colliders = lower FPS / lower performance. So, try and keep them to a minimum. I have a set of octagonal hollow fuel-tank parts that use 8 colliders each and have not been able to notice any performance degredation; but they are also used sparingly (e.g. only 1-4 of those tanks on a typical vessel).

Edited by Shadowmage
Link to comment
Share on other sites

colliders are a pain in the butt, but this is how you do it:

you need to line the inside with box colliders, or you can use capsule colliders. You need to edit them, and put a bunch around the circle.Screen%20Shot%202015-08-28%20at%202.41.15%20PM.png.opt860x537o0%2C0s860x537.pngScreen%20Shot%202015-08-28%20at%202.41.23%20PM.pngScreen%20Shot%202015-08-28%20at%202.43.55%20PM.png.opt860x537o0%2C0s860x537.pngScreen%20Shot%202015-08-28%20at%202.45.10%20PM.png

- - - Updated - - -

No, you use many colliders - more than 2... at least 3 are needed to form a hollow shape.

If your cylinder is 24 sided, you would likely use 12, 16, 20, or 24 colliders (or more!), depending on how closely you want the collision shape to follow the actual tank shape. Essentially you would have one collider for each side/quad of the cylinder (more or less depending on how closely you want the shapes to match). These would be as tall as the cylinder, but thin enough to still allow proper room inside the cylinder.

So, intead of making a single collider in an O shape; you would make something like:


___
/ \
| |
\ ___ /

where each of the segments of the wall is its own collider.

(Sorry, at work at the moment, so cannot do any proper images).

Keep in mind that more colliders = lower FPS / lower performance. So, try and keep them to a minimum. I have a set of octagonal hollow fuel-tank parts that use 8 colliders each and have not been able to notice any performance degredation; but they are also used sparingly (e.g. only 1-4 of those tanks on a typical vessel).

Here, I did the images for you, but they aren't the greatest.

Link to comment
Share on other sites

No, you use many colliders - more than 2... at least 3 are needed to form a hollow shape.

If your cylinder is 24 sided, you would likely use 12, 16, 20, or 24 colliders (or more!), depending on how closely you want the collision shape to follow the actual tank shape. Essentially you would have one collider for each side/quad of the cylinder (more or less depending on how closely you want the shapes to match). These would be as tall as the cylinder, but thin enough to still allow proper room inside the cylinder.

So, intead of making a single collider in an O shape; you would make something like:


___
/ \
| |
\ ___ /

where each of the segments of the wall is its own collider.

(Sorry, at work at the moment, so cannot do any proper images).

Keep in mind that more colliders = lower FPS / lower performance. So, try and keep them to a minimum. I have a set of octagonal hollow fuel-tank parts that use 8 colliders each and have not been able to notice any performance degredation; but they are also used sparingly (e.g. only 1-4 of those tanks on a typical vessel).

Ahh, that is a very smart idea, thank you. Only trouble is, I believe, only the top mesh is working. See below for details.

Okay so I did that but only the top mesh is actually being applied to the model in game, at least that's what appears to be happening.

Here's the mesh:

o8Qjmz2.png?1

And here's how the game engine reacts:

aMTe6x2.png?1

Link to comment
Share on other sites

Ahh, that is a very smart idea, thank you. Only trouble is, I believe, only the top mesh is working. See below for details.

Okay so I did that but only the top mesh is actually being applied to the model in game, at least that's what appears to be happening.

Here's the mesh:

http://i.imgur.com/o8Qjmz2.png?1

And here's how the game engine reacts:

http://i.imgur.com/aMTe6x2.png?1

That sometimes happens to me... I don't know what to say. Check this thread and see if it has anything about it.

- - - Updated - - -

This sounds really stupid, but you could create a specific game object for each collider, and put them under your main game object. I haven't tried this, but it might work.

Link to comment
Share on other sites

That sometimes happens to me... I don't know what to say. Check this thread and see if it has anything about it.

- - - Updated - - -

This sounds really stupid, but you could create a specific game object for each collider, and put them under your main game object. I haven't tried this, but it might work.

Very good idea.

Just tried it out and it works!! Thank you!

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