Jump to content

Method to Make a Movable Collision Mesh?


Recommended Posts

Assume I have an animated part. There is a collision mesh parented to that part. I then attach another part to it, such as a battery. When the first part animates, I want the second part to travel with it. Is this possible in Unity?

As of now, when I parent a collider to the animated part and add another part to the first part, as I animate the first part, the second is left behind clinging to the non-moving collider mesh.

thanks

Link to comment
Share on other sites

if you mean moving a part attached in VAB/SPH, it won't work. If you mean in Unity, it's a matter of attaching the component directly to the animated part; or childing the collider to the moving part in Unity.

You can move the collider if you child it to a moving transform in Unity, landing legs and gears do just that. animating the collider properties like radius, height, won't work, you will get an error about animation curves when attempting to load the model.

Link to comment
Share on other sites

I don't mean in the VAB/SPH. I'm not trying to directly animate the collision mesh.

Here's what I tried:

1. In Blender, I created the collider mesh and and made the moving part its parent

2. In Unity, I selected the collider mesh and removed the render component. I then added the "mesh collider" component to it. Unity indicated that the collision mesh was a child of the moving part.

3. In KSP, I moved the animated part (parent) not the collision mesh. I tried this in both the VAB and the launchpad.

You make an excellent point about the lander legs and landing gear. I must be missing something.

Edited by Apollo13
Link to comment
Share on other sites

In the other hand, landing gear and legs use special and dedicated module to handle them, which may, or may not, take care of the moving collider, which is not the case of the basic PartModule used by static parts.

I tired once with a kind of "corridor extender" without success, collider was generated by unity, convex and tied to the mesh.

It may be possible to do something with Infernal Robotics (like the piston for example).

Link to comment
Share on other sites

The problem is not that collision meshes are not movable, because they are.

The problem is that the position of the child part (the part you attached) does not get updated. It has a specific position relative to the parent part and once that position is set, it is not changed.

The game has no concept of an object being attached to a specific mesh on an object with multiple meshes. It's just attached to the object.

Edit:

Justin's probably right about IR. Or maybe not; I'm not sure if IR parts move just a part of a mesh or the entire object....... but maybe you can accomplish what you want using IR, or see how they do it.

Edited by Starwaster
Link to comment
Share on other sites

@Starwaster: If I understand you, the battery in the above example cannot rotate with the red lever. The battery is attached to the object, which consists of the red lever and turquoise plane. True?

Edited by Apollo13
Link to comment
Share on other sites

@Starwaster: If I understand you, the battery in the above example cannot rotate with the red lever. The battery is attached to the object, which consists of the red lever and turquoise plane. True?

Correct.

It doesn't even know which of multiple meshes it was attached to because the only real attachment is the object as a whole.

It's not practically possible.... (theoretically maybe but that's a big maybe)

"The technology involved in making something properly invisible is so mind-bogglingly complex that 999,999,999 times out of a billion it's simpler just to take the thing away and do without it......."

- Douglas Adams, Life, the Universe and Everything

Link to comment
Share on other sites

Hi tried to do just this very thing for ages, and i'm firmly of the opinion it can't be done , one of the IR chaps explained to me why, it's something to do with collider origins iirc, but this is the reason IR exists, because if it was possible we'd all have animated robot arms etc. It's a lot easier than you may think to incorporate an IR element in your hierarchy , check out the IR tutorial , that I can't find again. and if you do go down the IR route I'd be happy to help with any issues

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