Good catch! Reverse gear will flip director of neutral turn. Should be easy to fix.
I’ve added third part of tutorial to the first post.
Awesome work BoredEngineer, and thank you OldRaven for the tutorials! This will hopefully help me get started on my own tracked vehicles in the near future.
You are welcome Wacki!
I like tracked vehices so I’m just glad I can finally make myself usefull and help other people on the way.
I have been testing with the Wheel collision radius and the drivewheel radius, but they don’t seem to do anything when you change the value.
I’m moving my lowres standin of the Tiger 1 into UE4 and hooking it up with your blueprint, but got some weird results and cannot find what’s going on.
First of all, the Drive wheels wheels are 40cm radius, so setup the drivewheels that way in the blueprint, and setup the wheelcollisionradius to be bigger then that for when the tracks are on it later.
But as you can see, whatever I do it’s always like in the video with the wheels through the floor.
No matter how big I make the wheels collision radius… it’s never going any higher then this.
Any idea where I need to look?
I checked with the M113 and when I increase it there it also does nothing… I did not notice this before since the cv90 has the same wheel radius as the M113.
Looks like the radius variable i not connected or something.
Here’s a video to show you what’s happening.
Could you please take a screenshot in debug mode? It’s Shift+alt+D as far as I remember. WheelCollisionrRadius should scale the sphere of SphereTrace and it’s visible in debug mode. Are you changing this value in Performance section of variables or suspension?
Thank you, Wacki! The more people join this the easier it will be to improve it. User feedback is super important as I can’t completely test it myself.
And somehow the left rear wheel also get shifted to the side… I have to move the suspension of the last left wheel inward to get it to line up properly.
And I change them in performance section… did not know you can change them somewhere else
Wait… I see you alos have them in the Suspesion Setup L and R. And they are not connected to the performace radius setup.
Do I also have to change them there?
It looks like SphereTrace doesn’t scale properly. Which is weird as I think I’ve tested it on Ripsaw - it has smaller drive wheels.
Suspension handle (white static mesh sphere) should be placed on top of the middle of each wheel, did you moved them?
I should disable drawing of that gray collision mesh. It’s not working for collisions anyway.
That grey collision mesh is my wheels reference placement so it’s not yours.
If I modify the wheel collision radius in the suspension handles it works.
What is the difference between the radius in the performance tab and the one in the suspension handle? I thought they where the same.
I also have a problem on the left side with the flip animation… I have to look into this… could be pivot related with my wheel.
I will get back to it later.
And yes I did move the suspension handles… will check what I did there before bothering you again
Hmm good question I thought that all unused variables were removed. Which means that collision radius from performance section is still used somewhere, which means there is a bug somewhere… I will look into this.
No worries at all, quite often, just describing a problem helps to find a solution to it.
As far as remember, suspension will move your wheel. Check if position and rotation is properly setup at suspension handle. It’s done in such a way so you could have a spring of suspension working in different directions, not only vertically. I’ll modify Ripsaw setup to demonstrate this.
New update is up!
Fixed issue with automatic gearbox controls:
- now if vehicle is almost not moving steering will be done in regular mode
- if vehicle is rolling backwards or actively moving backwards (backwards is pressed) then steering will be done in reverse
- removed two confusing variables from Performance section, WheelCollisionRadius should be setup in suspension array
- added new “work in progress” setup for GAZ-98 aerosled
- made front and back roadwheels of Ripsaw bigger and turned their suspension to 15 and -15 degrees, to demonstrate that suspension and wheels don’t need to be exact copy of each other
Nice!
Cannot wait to check it.
While I am currently adding the Tiger1 I have another control input suggestion.
For some older tanks it would be great to have a seperate throttle for the left and the right track.
If you look at a T34 for example they have 2 sticks… one for the left track, and one for the right.
How difficult is that to add that as a movement input option?
I image hooking that to an xbox controller for example where you use the left and right triggers for that.
That’s actually is the easiest control scheme because at the end of all this input processing we arrive to two variables - WheelLeftCoefficient and WheelRightCoefficient which set how much power should be provided on each track.
I’ll see how it actually can be added. I stick to AxisInput for steering and throttle specifically because of controller, just need to add some switch between multiple InputAxis.
Yes I thought so … I see these left and right track torque on screen and I thought… you can probably hook them up directly to an axis input.
I fixed the problem with the roadwheels shifting on the left when I run the simulation with the Tiger1.
I had 2 suspension handles mixed up in the blueprint
Adding the tracks now… looks super cool!
O and one thing… How can I make sure the sprocket also collides with what it runs into… currently the sprocket does not seem to have any collision. (and the idler also)
Wanted to tell you about this multiple times and completely forgot. The easiest solution is to add small collision cylinders as extra UCX_ meshes on to the hull itself. Sprockets and idler don’t move so it’s fine to have their collision as part of the hull.
Alternatively you can use idler and sprocket with collision mesh and enable it, only collision not physics. Check how it’s done for M113 and Ripsaw. The main difference from adding their collision to hull is if you want them to have a different physics material, like I did. I’m not sure if it’s a good approach for something like a Tiger I as sprockets on it are huge.
Maybe try both approaches and see which makes more believable behavior.
Tiger I looks really cool! Even if it glitched through floor It’s fun to see so many moving parts turning into rather smooth ride. How heavy is that thing?
Update for aerosled prototype:
- air drag force can be applied at arbitrary position. Helps to imitate higher air drag at engine radiator plate than at the root of the streamlined main body
- separation of airdrag helped to stabilize chassis from kneeling forward due to the thrust from propeller not being alligned with the center of mass
- now there are two airdrag components, each effecting only the part of the vehicle
- much smaller and more realistic thrust from propeller
- suspension at the back has much higher stiffness than in the front as it needs to support most of the weight
One of the control designs for older tanks:
it should be easier to map it on gamepad than on keyboard. Perhaps some of the buttons can be used to get separate brake inputs for left/right.
Older tanks bring up something that I didn’t planned from the start - separate gearbox for left and right track.
EDIT: I know that WW1 tanks and some tanks made in-between wars, were steered by braking left/right track separately, so they were loosing power in turns. Were there two sets of gearboxes on WW2 tanks? Two gearboxes sounds like needlessly complicated even for military hardware.
EDIT2: I’ve used this article as a reference before. So there were transmission with two separate gear boxes:
Yes, it is easier to do that with a controller.
I had it with the physic tank in unity.
I would not do up and down shift for the tracks… just keep it simple.
In unity we used an xbox controller and the left and right trigger where foreward for the tracks… and the left and right bumper where reverse for the tracks.
Was actually pretty fun way of driving
I don’t know how ww2 tanks did this is real life… I believe like you said the left and right lever where just a brake… so you steered by just slamming the brake on one of the tracks.
“General layout” works this way - Automatic gear shifting is done on a basis of angular velocity of axle. Velocity of axle is driven by both engine and wheels. Neutral turn doesn’t shift gear box into a reverse gear. There is a special reverse gear before sprocket which can reverse direction of rotation but for what ever reason it’s used only for neutral turns. During neutral turn, angular velocity of both tracks is the same, just with different sign. From the point of view of axle they are rotating with the same speed. Why it’s important? Because both tracks are in the same gear all the time.
With “Old tank layout” I’m not sure how to go around reverse gear of the tank and control logic. If tank would have two gear boxes, then each of the sides could be upshifted/downshifted independently. With a single gear box we need to define something like this:
- if tank is standing still and both tracks are throttle backwards (Z&C) then we shift into reverse gear and go backwards
- if tank is standing still and one track is throttled forward (A|D) and other is throttled backwards (Z|C) then we do a neutral turn using current gear
- what happens if only one track is throttled and other one is idle? In previous setup it’s impossible because steering is on the same axis, here we have two independent axis to control steering. We can put idle track into “neutral” state, it will rotate only because of friction. This way gear box will be happy because idle track won’t effect axle velocity.
This article describes pretty much all different configurations which were used or still used: http://www.gizmology.net/tracked.htm
I was thinking of how all different configurations of control scheme and power distribution can be supported.
One approach is to override input specific code inside of the specific child blueprint. For example, you could make something like A_WW2_TrackedVehicle (child of A_TrackedVehicle). In A_WW2_TrackedVehicle you could completely override how input is processed and then each of the actual WW2 tank models can be based out of this class. The other changes you could do in A_WW2_TrackedVehicle is for example non-gyroscopic turret and etc. What ever would be very different in them from modern tanks.
Another approach is to switch to component based architecture, then input processing would be done by a special component which job would be to receive input from multiple axis and return calculated “torque on side” coefficients. With this approach you could simple copy/paste control scheme from one tank into another, regardless of their class hierarchy.
Otherwise it’s starting to turn into spaghetti code where most of the code is about dealing with corner cases rather than providing new functionality.
Something like “Geared Steering” Notes on Tracked Vehilcle Steering can be controlled in following way:
So there are many options in regards to how tank should behave, how to map it onto controls is a bit different story
good work guys . i dont know how to help you … but if you can look at this video maybe will help you , or giving you some ideas . i dont know >> [Playground] - Testing Constraints & Modular Vehicles - v1.1 - UE4 - YouTube