Disc Collision Mesh: Not sure if question or feature request

I am making a disc-like object with a rounded outer rim. I need it to roll very smoothly. I can achieve that with a sphere collider, but that has a lot of problems. Even if I did the workarounds necessary to get the disc to move normally with a sphere collider, it would take more calculations and tick updates than I’d like. It would also leave the collider sticking out on the sides, which is not going to work for my project. Capsules will also not work, since I’m dealing with a disc and not a tube. And even in the case of a tube, the ends of the collider would still stick out

I have attempted to use Auto Convex Collision, but even with the maximum settings, it doesn’t provide a smooth enough surface. I could achieve it with a sphere and 2 boxes that overlapped it on either side, if booleans were allowed for collision meshes. I imagine that if that were allowed, the engine would do something like this, and probably wouldn’t need to work much harder:

“Oh, look, collision mesh A hit something! Oh boy! But is the point of contact within collision mesh B? It is? Well, I guess we won’t consider it a collision for physics purposes, then. Darn.”

That seems like an obvious move, and I’m really hoping that I’ve just missed something obvious. Can someone please tell me I’m missing something important?

I’ve looked around quite a bit, but it also doesn’t seem like curves of any kind other than spheres and capsules are supported in any way. Is this actually right? It seems like it should be pretty simple to squish a sphere collider until it was thin enough for what I need, but scaling a sphere collision mesh on any axis just scales the whole thing, apparently. I understand that there would need to be an additional calculation for the shape and orientation of the resulting spheroid, but it doesn’t seem like it would be too cumbersome to use, particularly if it’s only used on important objects.

Has anyone done something like this? Does anyone know how to get this sort of result? Is there some dark ritual magic I need to perform to make a round-but-not-spherical object roll? Any help is appreciated.

On the mesh editor Details tab > Collision, there’s a property “Complex Collision Mesh” which might just be what you need. Try modelling a cylinder mesh and setting that property to it?

That will not work unfortunately, as complex collision is for static objects only, and I need this object to move.

Edit: Moveable objects can have a complex collision mesh, but it will only use a simple mesh for physics. Attempting to use the Complex mesh as simple option will just throw errors for a moveable object.

1 Like

The two main uses where “cylinders” are needed rather than just well tesselated convex hulls, or box stacks, is:

  1. Barrels. Best work-around is to use a capsule, and stick a box on the inside that doesn’t go outside the barrel walls. The box lets it stand on flat ends; the capsule lets it roll when knocked over.
  2. Wheels. This is for car physics. Generally, using boxes for side collisions, and using ray casts for wheel/suspension/contact/friction, will let you get far enough.

I wonder what the Chaos vehicle use for its wheels?

1 Like

There are a couple of problems I can’t easily fix with those solutions. First, the edge of the disc is rounded, and I need it to be rounded. A cylinder could work, but would give me some odd lifting from the ground when the disc tilts, and it would need to be very smooth. This is one of the main components of the scene, and will be used almost constantly. I need it to roll smoothly, like a disc would. Any oddities in its motion, like rocking back and forth between two edges when it comes to a stop, or like lifting slightly and falling back down will be immediately noticeable and jarring. Sphere and Capsule collisions are the only things I’ve found so far that roll smoothly. Unfortunately, since the disc is thinner than its circumference, a capsule is no different than a sphere for my purposes. If it was a long shape with a small diameter, I could use a sphere or capsule and the end blocks. Even if it was tapered, I could use multiple spheres. But those options don’t work for this.

No discs exist physically – they are all (thin) cylinders.

If you want 100% “smooth, on rails” movement, then perhaps an animation-based approach, or a spline-following approach, would be better than physical simulation?

Another option would presumably be to crack open the C++ implementation of Chaos and build the Disk primitive. It looks like such a thing could be plugged in, but that’s obviously a bunch of extra work …

I understand about the disc/cylinder thing. You’re right, and if I had a smooth enough cylinder, I could almost use that and be fine. The issue is that the shape I need is actually rounded on the edge, making it more like a narrow spheroid with the sides sheared off. You may be right about having to use animations or some other alternative. It would be really nice to be able to use the physics for motion, since there’s so much it does natively, but I should be able to get satisfactory results without it. I did look at editing an existing primitive, but you’re right that it would be a lot of extra work. Also I’m trying to avoid including C++ in general, since using visual studio professionally is expensive and unreal won’t use alternative compilers (because reasons, I guess). Maybe I’ll look into making such a primitive in the future…

When I say “cylinder” I mean a collision shape that is actually a parametric cylinder, such as used for wheel colliders.
There is such a shape defined in Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Cylinder.h
(There is also a Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/TaperedCylinder.h btw.)

Now, these don’t have simple actor components that you can add in the Blueprint editor, but the Chaos Wheeled Vehicle does seem to use them, so presumably they work when you use them in C++. I have not tried it, but if I needed a smooth rolling cylinder, I’d check out what the WheeledVehicle does with these, and go from there.

1 Like

I was surprised to find that is Chaos there still is no cylinder collison. Everyone who works with the engine runs into this same issue with no cylinder collision. It is interesting that the Unigine engine has a cylinder collision.

Excellent information Jwatte! How would you be able to get the cylinder to work in Chaos? I use BP and not forsure how you would go about making that work. I had created a thread to get some help on making a convex cylinder work but have not gotten any help yet. If you can make a cylinder collision somehow with C++ I would love to know how, maybe a plug-in or someway to expose to BP. Collison Geometry for a Physics Based Motorcycle?

I would just like to put my hand up as someone who is in exactly the same boat. It seems physics driven bicycles/motorcycles are inherently going to be a problem with the limited choice of collision primitives.

And I agree- a boolean type system, where you could chop out the sides of a sphere with a couple boxes on each side, would do the trick!

My only advice here if you are not C++ proficient (as I’m not), is to maybe employ the help of an AI assistant, such as Claude AI, which I used recently to help me to develop a C++ plugin, which worked very well. I will probably go down this path soon to see what I can do, because the custom or generated mesh options don’t seem to be working out too well so far.

Cheers!

They aren’t.

Bycycles are just cars with 4 wheels that have 4 invisible wheels.

And no, using Claude or ChatGPT is a horrible idea if you don’t know enough to verify what it gives you back. Actually its a horrible idea even when you do know enough…
Really. What’s wrong with you just learning what you need to learn to achieve what you want to achieve?
Is it an “I’m against learning” thing or what?
Because AI isn’t really going to save you time.
But you can exploit the AI to actually learn instead…

Additionally, do keep on mind that Chaos Physics can barely do cars.
Attempting to make a completely useless accademical realistic bycycle would definitely be near impossible.
If not just for the fact that the engine physics don’t really understand the concept of gyroscoping…
You would basically need to write a classical mechanics setup to get it to work.

And the OP issue was a decent one, in academic terms.
A circle has infinite precisions whereas any defined collision does not.
Thus, making a sphere or a sphiel would allow for perfect “rolling” while using custom collisions would not save for very complex and expensive versions.

When all you need is a radius definition for the math to work, and you don’t have that option - yes, it does seem like the engine is lacking. Which it 100% was and still is, and likely will always be.

You should probably stick to box collision.
A box is also a circle. With corners.
You just fake the object rotation without having any physics to it, like all the cars do…
Because of the corners you will likely need to adapt smaller than radius objects to provoke fake collisions - so you can use collision channels and a sphere the exact size of R to define/check that collision and apply impulse to the object or similar