简体   繁体   中英

Unity fast way mesh collider to pipes

I am working on a project and this project has pipes. When ı add a mesh collider on pipes this is happening in photo在此处输入图像描述

is there any fast way to add collider correctly?

You might need to checkout the convex checkbox:

在此处输入图像描述

That has its implications dealing with collitions, check the documentation . At it says in the docs 'Enable the checkbox to make the Mesh Collider collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles.' so it is not convex you might have problems to make it collide with other convex gameObjects, but can be OK for your determined case for example if you need for a raycast.

Edit:

I had a similar problem to yours working with unity lineRenderer but instead of a pipe was a longitudinal plane following a 3d path. I think that your chances are to try to make your mesh below 255 triangles and check if that works, or as you say, wrapp your types with primitive colliders (box or capsule). As it seems in your game the pipes are straight, so you can attach a capsule or box collider to each of the chunks of your pipe. If the pipe was curved and could move in the game as was my case, the problem gets out of control because you have to code the collider wrapping of your curved game object(s) and the collider behaviour as it moves.

I would check anyhow if with the convex checkbox unchecked it works. On the other hand you might find this helpfull

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM