Stone Blue

[Solved] Why are... Colliders...SOOOO...Hard!!??!!

Recommended Posts

OMG!!... Yes, I'm new to modelling... Been screwing with a part (engine) in Blender & Unity for several days now, and it seems 80% of my issues are due to a stoopid collider...

I've read many threads, I've watched many video tutorials...
I've tweaked and changed ALL kinds of settings both in Unity and Blender, and i JUST CANT GET MY COLLIDER 100% figured out... :(

Finally found a KSP shader that "seems" to work... Finally got the dang axes to orient properly...

Now my last issue, is that my part is selectable and placeable in the editor... But once placed, the part cannot be selected or removed again...

Also, if I launch with it, it wiggles around during physics loading, then when activated (its an engine), it separates from the rocket and goes spinning off on its own, still thrusting even though its no longer attached to anything... (not even a fuel tank?...lol)

IIRC, I read this might be due to the collider... In tweaking everything to get a 90% workable model model, I notice the blue wireframe highlighting for the collider mesh in Unity has disappeared, also... I've rechecked the collider settings, and I cant figure it out.. I'm sure its something simple I'm missing, but for the life of me...

SOMEONE PLEEZE HELP!!

Thanx :)

Edited by Stone Blue

Share this post


Link to post
Share on other sites

I tried without, but then Unity refuses to output the model... I deleted the collider material... no go... ???

Here's what I have for the collider in Unity:

8B51MdF.png

 

Edited by Stone Blue

Share this post


Link to post
Share on other sites
4 minutes ago, Stone Blue said:

I tried without, but then Unity refuses to output the model... I deleted the collider material... no go... ???

post a shot of your unity setup and part hierarchy, it will tell us most of your issues

Share this post


Link to post
Share on other sites

Although it doesn't show in the pic i suspect  you will have a warning somewhere saying your mesh collider is in excess of 255 polys, you wont be able to fit a single convex collider around that engine without running into issues I suggest quickly returning to your modelling app and making some very low poly meshes that approximate the engine shape and use them as colliders, reimport it all to unity and add a convex mesh collider to the low poly parts and the delete the mesh filter and mesh render parts, this will leave you with 3 ( 'd do it in 3 ) low poly colliders

Share this post


Link to post
Share on other sites

Hmmm... So a low poly cylindrical mesh surrounding the whole thing wont work?

This is what I have in Blender (collider is slid down for reference, of course):
 

XMU4cjH.png

Share this post


Link to post
Share on other sites

If that is all you have it should work, (if that's in the first pic too I'm wondering why it's not highlighted when you have it selected?)   make the collider a child of the engine,  and as before fit convex  mesh collider and delete mesh render and mesh filter, and have you checked the logs for the times when you have changed it and it has not shown up in game.?

 

Share this post


Link to post
Share on other sites

Just checked the logs now... Only error for the part is "no dtabase record...creating one"...

I see warnings for over 255 polygons for Squad parts, but not this one...

Yeah... At one point, the collider mesh WAS highlighted in Unity... Dont know what I did to make THAT disappear... :(
At that point, the collider was showing up as gray texture in game, like a fairing... Thats why I tried deleting the collider material, but Unity didnt even want to write the model with that gone... So thats when i started trying different shaders, hoping to find one that would just make the collider invisible... Came close a few times, then finally found the one that makes it completely disappear ingame... but now I've got the issue I first described in the OP... \o/

I'll try what you suggested in Unity now...

EDIT: Ahhh!!!... Found why the wiremesh disappeared, and why it was separating from the craft... Scaling issue... This is remnants from messing with someone else's model... :wink:

EDIT2: This is what I get from Unity when I delete the collider material, and it refuses to even output the model:

File error: Object reference not set to an instance of an object
  at KSPPartTools.PartWriter.WriteMaterial (System.IO.BinaryWriter bw, UnityEngine.Material mat) [0x00000] in <filename unknown>:0
  at KSPPartTools.PartWriter.Write (System.String modelName, System.String filePath, UnityEngine.Transform target, TextureFormat textureFormat) [0x00000] in <filename unknown>:0

UnityEngine.Debug:LogError(Object)

EDIT3:

Well, it's CLOSER to working now... Part works as it should, with the collider materail added back in, EXCEPT, the collider is now showing up as a gray texture (like a fairing), in the editor, only... ??? It does NOT show in the part icon, nor when I select the part and drag it into the hangar...It ONLY appears once I actually ATTACH it to another part...??

It disappears and everything seems to work as normal in flight...

I guess I'll leave this issue alone for now, since the part seems to be working other than this minor inconvenience...

Now I have to figure out how to add a heat emissive animation for the bell, and add a fairing... Oh joy!... I hope those end up being easier than this collider thisng...lol

Thanx for the help so far, @SpannerMonkey(smce) & @nli2work :D

 

Edited by Stone Blue

Share this post


Link to post
Share on other sites

Not sure if it matters, but try right clicking the "Mesh Render" component in the inspector window at the right of your Unity Screen, and "remove component".

Share this post


Link to post
Share on other sites

OMG!!...REALLY?!?!.... THATS ALL IT TOOK??!!!...

You nailed it, @cxg2827 !!  Thank you!...

Between the three of you, now I wish I hadnt been so stubborn, and posted about this three days ago when i first started pulling hair out over this...

I was digging for a way to remove the rendering, or at least a way to select <none> for shader or something...

So, lesson learned, is even with the Mesh Renderer checkbox UNchecked, Unity must still want to assign a material .... ???
And who'da thunk right-click would bring up a menu of items not available in the couple small icons on the right corner of the Mesh Render component...??

Well, glad THAT lesson (and the things mentioned by Spanner and nli2work) are learned... :)

So does anyone have links to threads or tutorials on how to set up the heatemissive and fairings?... :wink:

 

Edited by Stone Blue

Share this post


Link to post
Share on other sites

ninjaed

remove everything on the collider except the mesh collider component.

Transform component is required on all game objects, without it there'd be no gameobject.

Mesh Filter selects a mesh object for Mesh Renderer component, without Mesh Renderer there's no point having a Mesh Filter component.

Mesh Renderer makes mesh object in Mesh Filter visible and have visual surface properties based on the Material assigned.

Mesh Collider doesn't need any Mesh Filter or Mesh Renderer. Colliders shouldn't be visible. and the component has it's own Mesh filter field. The material field is for Physics Material (not implemented in KSP) that define physical properties like friction, bouniness.

 

Edited by nli2work

Share this post


Link to post
Share on other sites

COOL!! This is a good tutorial on how to make a engine.

Share this post


Link to post
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.