Chariot Simulation

I am working on a chariot simulation. I have a blueprint, with a main body (chariot) and two other objects (ThrusterL & R) that are constrained to the main body. When Left Trigger is pressed it applies force to ThrusterL and the same on the right. The thruster objects pull the chariot well. You can turn by reducing or increasing thrust for each thruster independently.

It’s a little hard to get the chariot to get back to center. It wants to keep turning and it is very hard to balance the chariot to go straight again. It’s more frustrating than fun. So, I am trying to make some kind of dampening effect. I have messed with all the angular and linear dampeners in the physics objects to some positive result, but not enough. Most recently have been working on a MaxVelocity function to try and convert any sideways velocity to forward velocity. This attempt hasn’t yielded much result so far. I thought I should seek advice on how to tackle this problem.

I can share the project file, but I’m not sure if I can do that here. Thank you for you help!

Hi there, so this is something like pod race type of chariot seems. Not fully aware of your setup and what aspects you used but seems its simulated objects to start with.

So when you apply force to left or right, it applies linear force and cause of the setup possible applies angular force to overall setup, which enables you to turn as you want. However if there is no angular dampening on your physics objects this will continue spinning for a while (depending on the friction factors between object and ground surface).

I beleive increasing friction on physics materials also increasing angular dampening on your simulated physics should solve the issue.

Velocity clipping not going to solve issue fully since I assume this is simulated but its possible to reset angular forces more rapidly on the simulated objects. Dampening alone will not feel good so I suggest getting angular velocity and applying an additional force on the objects as counter direction. Could be even better if something decays over time.

CorrectiveTorqueZ = -AngularVelocityZ * StabilizationStrength

thats how i would do it atleast. Let us know if I got the question right.

1 Like

This was spot on! Yes, it’s legally not pod racing, lol. There is definitely a sweet spot for the default dampening options. I find making the Thrusters heavier than the Chariot helps a lot. I have the Chariot LD about 0.1; AD does nothing really. The Thrusters are 30x heavier than the Chariot; AD 0.8. The Linear Dampening for the Thrusters varies.

When you press the trigger on the gamepad it preforms ((TriggerValue) * -10)+10 to get the value of the Linear Dampening for the associated Thruster. This acts as a variable brake when releasing the trigger. This works great except when fully and instantly releasing the trigger. Then the Thruster slams back and pops the Chariot up. I am thinking I should work on a ramp down function.

The Corrective Torque you suggested shows a lot of promise. Ill have to work with it more tomorrow. Thank you for you’re help!

The counter torque should work nice for turning and interms of inputs I think its natural behaviour when input suddenly cut makes sense since the dampening and other forces are high on vehicle to trigger instability. That is expected in real life scenario too.

My suggestions on this are couple of knobs to play with.

  1. I am not sure you have input accumulator. In inputs you can assign accumulator or you can create one on tick as InputGravity interpolating from -x +x. This would give a nice gameplay effect too, make a bit harder for player to control. Imagine this is like a galleon ship, not easy to turn however the gravity should be something not frustrating in order not to butcher responsiveness of gameplay.
  2. I think while having an InputGravity, its absolute value can be a scalar to dynamically change the dampening, angular dampening even maybe the counter torque. That way the forces on the overall vehicle will be smoother decreasing any instability.
  3. Depending on the setup as you said there is 30x difference on masses, inertia tensor scales can be helpfull, especially I think on Z, having less inertia or completely closing inertia on the thrusters can effect positively the input and stability problem.
  4. For the overall center of mass, its good to override CoM to be somewhat low center of the vehicle since there is 30x difference , changing it can effect setup positively if the 1.2.3 doesn’t respond.

It’s a good question and something interesting, so It’s my pleasure to dig into it.
Let me know if it works on your side.

1 Like

Additionally not sure your setup is but with the new modular vehicle with some additions I made its pretty nice results (without them also acceptable) however here is a pod racer chariot made with similar two trusters, some springs and a custom joint for the cockpit.

1 Like

Wow! The Modular Vehicle System looks perfect for this. I know nothing about it presently. Below is my snapshot of what I have. With your suggested Torque Corrector, particularly during the Boot action really helps controllability. I also added a reverse thrust button (shoulder buttons) for each side, respectively called break. Holding Brake and Thrust at the same time allows that Thruster to slide without adding force to the craft. This has given much greater control as well as the ability to reverse. You can ease off the throttle while breaking to get a drift turn going. Unfortunately, my current iteration struggles with any terrain deviation, so I am going to research the Modular Vehicle System.



Thats totally fine, there is a suspension component which simply a dampening hinge between components adding additional forces of physics object which is a union component. For sure its one of the most important things for trackion and stability however can be manuelly crafted also in your setup to all local Z Forces to stabilize vehicle.

However seems linear and angular dampenings working , also you can manually add helper forces if angular velocity is above something that you like.

interms of controls and stability can be a local force at some point on vehicle too somewhere stable along CoM ±X to backup turns. In a horse chariot scenario a high helper torque can be nice for minimal lateral slips.

It’s being developed there is many things as new but its subject to change aswell.

1 Like

So on turns when vehicle turning you can see clearly additions of torques relative to lateral velocity + input + vehicle velocity, giving additional grip cause of force changes on suspensions (surface of contact) and center of gravity changes additional force.

1 Like

Dang… I’m jealous of how good you are at this. How can I learn to do this? Where did you learn?

I have made no real progress on my end. I have been trying to look for good clear info on the MVS and study it. It’s been an okay pursuit. Mostly just wading through Youtube videos. I did experiment with a custom suspension function.

Basically it is a collider box under my whole craft. Then there is a physics constraint that holds the craft up. Each piece has their own constraint, so I can make the back (Chariot) part more bouncy without it actually affecting the crafts direction. It shows promise, but I haven’t invested the time to properly tweek it. I have also considered that maybe a cube isn’t the best physics shape for my collider. Maybe something with a bit of a bevel so it slides confidently over smaller deviations in terrain. Currectly the depentration on the hard edge of a cube probably is probably yielding some undesired results (bucking). Maybe I should get some cylinders and have them roll. They can be anything, as they won’t be rendered at Runtime.

Yeah thanks, me also quite excited about this one, thanks for the Chariot idea though, I was dealing with Trucks and Wreckingballs , I am also experimenting with the new networked physics, a little bit also journey into the under the hood of physics in unreal for me.

For now there is not too much source but there is a tutorial , some documents and forum thread going on, its still in development for sure gonna take for a while but its around networked physics.

However in terms of single player and working principles at very very base its the same. There is some modular vehicle examples in engine and already integrated modules, like suspension, aerofoil. In my example I integrated couple of custom modules just to experiment and learn. So far made custom

UVehicleSimArm : This is for heavy machinary it works like hydraulics
UVehicleSimArmFollower: Follower arm component to simultaneously control connected geometry collections relative to parent with different rotations and locations.
UVehicleSimRotator: Basically a rudder, injects/overrides rotations.
UVehicleSimSpring : This works like a spring, can be fake animation only or both, simulates a weight on rigid body uneffected from original rigid bodies actual mass. Has its own stiffness, damping, limits etc responds to angular velocities.

These were just to understand and try to make a pod racer in single vehicle but feels like 2 vehicles. I am eager to connect 2 vehicles and see what happens aswell, would be a stabilization challange for sure can be done though, its matter of force, mass balancing however not sure how its going to act in network.

Interms of making a spring a custom one would be easy. You can just make 4 raycasts (let’s say its 4 wheels) and apply forces on connected physics body at local point in Z direction until it balances in delta (some error margin). Modular vehicle fundamentally the same even I think mover works like that. I used that before in some other engine to make a galleon which is quite nice.

I would recommend making atleast 4 rigid bodies for Chariot since a single collision would be hard to control unless its a ice sledge Chariot which would be ok that time. For the vehicle follower think physics constraint should work.

My overall setup atm

So after a bit experiments, I was able to do a multiple body rig simulation without chaos and vehicle components just using blueprints and existing components. Of course I used some black magic but its ok.

So what I did just created a pawn class and one suspension component which is in the base a scene component.

Added a compression variable in this scene component since we will need to access that.

Then we need to build the vehicle.

Made 2 spheres one for follower one for the thruster, our horse, pod.

They are basically simulated a bit lower center of gravity with a little bit higher inertia tensor scales. This tensor scales will help us a lot stabilizing the movement and forces in the vehicle and make it predictable. Both of the objects Thruster and Follower has same settings, can be different though depending on the gameplay aspects we want to nail down. Also around the spheres made 4 suspension component creating a square/rectangle, we will use these points as reference to add stabilization and suspension forces.

Added my camera simply with spring arm and set pawn control rotation (can be different)

Added a physics constraint between them with some simple setting generally a limited free spring vibe.

In the vehicle made in movement input or simply used the existing one in template and set its action values to a variable including the completed status. Added a mouse look and add some controller inputs to be able to look around.

Enabled engine async physics tick in project settings also in the actor set use async physics tick

image

Get the physics tick event and start applying some forces on thruster. Get left right vectors , multiply with inputs and apply force.

After this we need to make a custom suspension and a gyroscopic stabilizer. Which can be done in many ways I just take a bit shortcut over there not to over complicate things.

So after the tick we start adding these suspension forces for each suspension component, simply 4 functions for thruster and 4 functions for the follower

For this function we input the suspension component and the primitive its connected to.



Its a bit long so i made also a snippet here https://dev.epicgames.com/community/snippets/eOJe/unreal-engine-custom-physics-suspension

So what this does is basically the same like mover or MVS but a much simplified version of it we can say. It traces the ground at a distance then calculates a compression on the suspension (0,1) - I also made a curve value on it so it can be more controllable something ease in would work.

I get this value and multiply by the max suspension force, you can try error a good value there and after save as a local value RequestedSpringForce, this is what spring wants to do raw.

Then we calculate a difference between ticks to estimate the velocity of spring here.

We multiply this with linear damping scalar and suspension force again to create a dampening counter force. Additionally can be clamped this value it creates stabilization. We get this dampen force and subtract from raw requested one , afterwards we multiply it with the impact normal to create a nice directional force and apply force at component location.

This is generally enough however since we don’t have a chasis or rollbar applications, i basically created a gyro functions on physics bodies after the suspension functions complete.

Simply we get the physics body, get its angular velocity and apply a torque. Similar to what we talked on the previous posts.

We should possibly do this for all rigid bodies simulated in a chariot , can be different setups though.

The results.

So this is a prototype no additional forces like friction , rolls but its quite stable even now.

I put together a small TPOC demo project that shows the setup I was talking about earlier.
It’s a Blueprint-only custom Pawn in UE 5.7 with fully simulated bodies (two horses + chariot) connected via physics constraints.

1

There’s no Chaos Vehicle or Modular Vehicle system involved. Movement, suspension, damping, and stabilization are all done using basic physics forces, traces, and async physics tick.
After suspension forces, I apply a small gyro-style stabilization torque to keep things controllable without hard-locking rotation this gives a smooth gameplay as well not entirely depending on the built in damping of the physics objects. At the same time suspensions in this example are dampers + stabilizers working with the physics assets not entirely depending on the ground traces which gives me more nicer vibes however can be solely dependent on the traces as well.

This is not meant to be a production-ready vehicle system however, just a proof of concept to explore how far you can push standard physics components with Blueprint logic alone, even this can be pushed further to be production scale however would require a bit C++ anyway.

Repo is here if anyone wants to poke around or reuse parts of it:

Happy to answer questions or explain specific parts if something is unclear even we can push a bit further more.