- Home /
Why no cylinder collider ?
This is causing me no end of problems with my motorbike game, wheel colliders are no good and sphere colliders are just plainly the wrong shape. Please help !
What @mizuho said - make your own primitive if you need it out of a mesh collider - if a mesh collider on its own isn't enough.
It would certainly be faster - I would use the most basic colliders that don't screw up the model. Not sure what needs to be a cylinder on a motor bike - maybe @s$$anonymous$$diworkz could tell us?
You can have a cylinder collider, technically.. Just add a primmitive cylinder and give it a $$anonymous$$esh Collider. I know, not actually a "cylinder collider", but it works quite well :)
You can't have mesh colliders colliding with other mesh colliders and thus this won't work. I have scenes where ramps are made from mesh colliders and can't be made any other way.
It will work since you can make the cylinder a convex mesh collider. Although this is technically not a cylinder collider, it's a mesh collider that's sort of in the shape of a cylinder. "Sort of" since the surface is a series of flat planes rather than a curved surface, although the built-in cylinder has enough faces that it generally acts as a cylinder when it comes to physics.
Like Eric5h5 says, if it is convex, it CAN collide with other mesh colliders.
@Fattie: nope, video games do not use cubes for wheel colliders, sorry.
Answer by Eric5h5 · Jun 18, 2012 at 10:36 PM
@ LS16B$$anonymous$$X Try to add mesh collider and set convex to true. That might work.
Answer by SimonePellegatta · Oct 19, 2020 at 09:32 AM
You can make one by adding two colliders (a Capsule Collider and a Box Collider) to the same object.
You have to overlap them in such a way that their intersection generates a cylinder.
Then:
ushort triggered = 0;
void OnTriggerEnter() {
triggered++;
}
void OnTriggerExit() {
triggered--;
void Update() {
if(triggered == 2)
{
//inside cylinder collider
}
else
{
//outside cylinder collider
}
Answer by CockCOckIsYes · Jan 12 at 07:34 PM
Add a mesh collider and set the mesh to Cylinder Unfortunately you can't really change the sizes and stuff