Custom Gravity question

Hello everyone, im busy with a racing game. Ive got an idea and im driving nuts over it since i cannot figure out how to do it (not so crazy since im started using UE5 1 month ago)

So i have this Hollow Cylinder Mesh and i can drive troug it (duh XD) when you drive fast enough you can drive up the wall and it acts like a loop de loop so thats ok. but now the real question.

How to give the cylinder gravity so if im driving inside of the cylinder and driving slowly that the car keeps having gravety on the inside of te cylinder wall even when upside down and not driving at all.

Long story short. How do i give the inside wall of the Cylinder gravity.

You could try to apply forces on the z-axis of the car, which would push it against the inside of the cylinder mesh.

Hello @OrbitalZones ty for your responce.

like i said before im kind of a newbie so i have no idea how to do that XD

I made a simple test project to prove my theories. Since the position of the force is currently set directly to the mesh position, the mesh of the car is pushed up to the top of the cylinder wall.

To get this solved, the source of the force should be at the center of the cylinder and the direction of the force must be calculated from the angle based on the current position of the car mesh. But maybe adding radial force would work as well.

Basically I created a blueprint and added a static mesh.
This is the only setup in the event graph, very simple:
Screenshot 2024-03-15 at 07.29.14

Had to increase the value for angular damping on the mesh, to prevent it from weird bouncing once it hits the cylinder wall.

@OrbitalZones Ty for your explanation,

I tried but as new as im i tried this on the car but its not working (front of the car gets up and thats it

If the front of the car gets up, it’s likely because the pivot point of the mesh or the actor is not centered. Maybe I’ll do some tests again, but this time with the UE vehicle template.

Have created a project from the vehicle template and did setup a new map with disabled gravity. But adding a force to the meshes of the vehicle Blueprints has the same effect as enabling again the default gravity.

well i tried but all im able to get is getting gravity working the opposite way, so now i can drive the roof of the tube but nog the floor XD

Found this plugin at the Unreal marketplace, think that’s exactly what you need:

There is also another plugin that is available for free, but it doesn’t support UE5.x.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.