Jump to content

Colliders make me think angry thoughts - Concavity


Recommended Posts

I'm aware you cannot have a concave collider in Unity/KSP, so I slapped together 26 convex colliders to make this:

z3xhT23.png

It is an adapter of sorts. I want those sides to be there so you can attach things to them, and everything is good and well until you try and stick something inside it (like an engine that it was meant to house):

6RzoNhZ.pngca9kiva.png

As you may have guessed, this is not the intended orientation of the engine. I initially had a single collider and assumed that Unity/KSP was assuming it was representing the top of the object (which it sort of is). So, I added a second collider just beneath it. Same thing. I've since redone the entire thing from scratch, including all 26 colliders, and got the same result. I checked the normals of the colliders, they are correct. I tried unparenting them from the mesh object, same deal. I even tried changing the origins, no joy.

From fiddling around with it, I can gather that if the face of the collider you're trying to attach things to is above the center of the object, objects snap on to the "top". Same for below the center, they snap on to the bottom. Presumably it works the same way on either side, because the outer faces work fine. From this I can safely assume that Unity/KSP uses this method to determine outward facings, and now understand why cargo bays are such a pain in the butt.

So, I suppose I basically need to know if anyone has found a workaround for this, or am I just going to have to resort to a flat plate?

Edit: I did have an inkling of an idea about maybe being able to set orientation via node_collider, but I can't find any useful documentation on it that tells me something other than "defines the collider".

Link to comment
Share on other sites

Is that engine surface or stack-attached to the underside of the part? You might need to check the surface attachment definitions for the engine itself.

It is surface attachable, and it works correctly if I set the attach node to -1 instead of 1, but I don't really want to do that because then the engine attaches upside down to everything else.

Edit: Turning off angle snap seems to allow them to attach in the correct direction, but I don't care for that as a solution since it requires moving them around afterwards with angle snap on again, and that pulls them up inside the model too far.

Edited by Randazzo
Link to comment
Share on other sites

Where's the root transform for the adaptor part? I'm wondering if KSP is measuring position against that to figure out the "out" direction, and if you move it inside the collider you're attaching to, there might be a small chance that'll fix it.

Link to comment
Share on other sites

Where's the root transform for the adaptor part? I'm wondering if KSP is measuring position against that to figure out the "out" direction, and if you move it inside the collider you're attaching to, there might be a small chance that'll fix it.

It started out in the center of the collider, then I moved it to the top face, then the bottom face, then far above the whole deal, and below. Only by moving the collider itself way down the object did the engine attach correctly, but naturally it looked silly having an engine stuck to nothing half a meter out of the adapter. Moving it back up to where it should be results in the above behavior.

I believe I may have to just start again on this one. At least it's simple.

Link to comment
Share on other sites

This is off a backup copy - I've already started on a new model just in case, and renamed the original. It's confusing unity since the models don't match, just in case you might wonder why it can't find that transform at the bottom (or why the model looks different.) But the hierarchy is the correct setup.

I still have the original blend and unity scene saved.

q2X2VT8.png

Edited by Randazzo
Link to comment
Share on other sites

I think what's happening is that the underside of the collider is above the center of mass, so the VAB thinks the engine should point up.

As an experiment, it might be worth lowering the part in Unity so that the "origin" is centered in the upper collider, and thus the bottom of the collider is below the CoM.

EDIT: I see this was already talked about. Doh! Well, you could try putting the origin of the root transform way above the part. Really the location only matters in a noticeable way when the part is "loose" (you've exploded and it's rolling on the ground), end when you're first grabbing it from the menu in the VAB (the mouse cursor will be "gripping" it by the CoM).

*sigh* I hate ugly work-arounds.

Edited by NecroBones
Link to comment
Share on other sites

Well I finally got the attachment orientation correct. Moving the origin of the object in Blender didn't have any effect on it's center for some reason, yet moving the mesh itself in edit mode while leaving the origin in place did. I don't know what the functional difference is there. It still had issues with angle snap then wanting to put the engines out the outside facing of the sides rather than the plate facing, even when trying to place in the center of the plate. I've deemed this thing too temperamental and not worth another days time, so it's been scrapped in favor of a flat plate.

Thanks all.

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