Project Making a Lua Script Vessel Car: The VW Thing

I'd be happy with Shift + N, D, R, or P.
Hmm, using Shift + makes sense as you are shifting, and lets those letters be used without conflict. Good thought.
Not sure about the "not roll backward or forward if no throttle applied even on a hill".....
Isn't that what an auto car would do?
Certain modern cars have a hill holder control that temporarily holds the brake until the gas is applied. That mechanism is usually only applied for a few seconds allowing the driver to transition their foot from the brake to the throttle pedal while on a hill. But an older, more basic car like a VW Thing would not have this. Allowing backwards roll would be more appropriate.
 
In a glaring oversight, I realized that my VW Thing should be rear wheel drive, even though I knew full well that the engine is in the rear 🤦‍♂️. I am too used to working on my Hondas and Toyotas. That travesty has been corrected. This makes the steering a bit more sluggish as there is no longer any turning moment provided by the drive wheels, but that just may necessitate some parameter tweaking.

It seems that adding approximately critical damping to the lateral friction force calculation stabilizes things nicely. One thing I realized was affecting the front end steering was the use of a rudder to provide the steering input. Steering left or right causes the front wheels to rotate to their stops quickly, and then return quickly to neutral position when they are released. This sudden change of angle generally puts the front wheels into dynamic friction mode even when the vehicle moves at slow speed. A rudder isn't a bad idea, but I need something that behaves like a ship rudder, not an aircraft rudder, something that can move smoothly stop to stop.
 
Last edited:
Doesn't "vessel:create_controlsurface" have a delay parameter?
I thought about that, but normal car steering doesn't automatically turn the wheel back to center when you release it. I thought about using rudder trim as a proxy, but it was actually simpler to remap the keypad 4/6 keys to increment the steering angle, and remap keypad 5 to set the steering angle back to 0 (kill rotation!). Seems to work well and it makes it a bit easier to manipulate the throttle with the keypad + key.
 
The ability to power slide in a VW Thing should have been a clue that something was amiss. All the while I was driving under the dynamic friction skid model, which actually didn't do too bad at low speeds. The logic that switched from the static to dynamic model was incorrect. Now if I attempt to cut the wheel at high speed the VW Thing rolls over without skidding, which is probably much closer to reality. I think correcting the vehicle to rear wheel drive also affects this.

The static model works beautifully now. I can drive sideways on steep slopes and not slide sideways:

Screenshot at 2024-10-24 14-31-20.png

Now it seems that it is just about impossible to get this to skid now, but again, it's a VW Thing. A different car with FWD or AWD might skid more readily.

I implemented a quick and dirty reverse gear - I can toggle it with the keypad subtract key to switch direction and use the throttle as normal. That will do for now. I can do 3-point turns and parallel park now.

One thing that I noticed is when going over particularly rough terrain the car will suddenly stop - it seems that it is bottoming out on some of the contact point corners of the car. I really should make another vehicle with more ground clearance for off-roading. Something like an old Willys Jeep would be great with this model.
 
  • Like
Reactions: JMW
The static model works beautifully now. I can drive sideways on steep slopes and not slide sideways:

That's great, but in reality shouldn't your vehicle be tilted to the right in the screenshot, as more weight would be transfered to the (British) "offside".
It looks like something is trying to keep the vehicle level to the horizon....
Don't want to be super critical, just an observation.

normal car steering doesn't automatically turn the wheel back to center when you release it.
All the cars I've had do. (except when driving along a slope) Think that is because of the Caster angle?
 
Last edited:
I dropped the version 2 VW Thing on the Moon and Mars and the suspension and touchdown points are correct, though it is hard to tell because the terrain rendering is terrible. Looks good with terrain off. Driving around with the correct contact points on the Moon:
 
Last edited:
That's great, but in reality shouldn't your vehicle be tilted to the right in the screenshot, as more weight would be transfered to the (British) "offside".
It looks like something is trying to keep the vehicle level to the horizon....
Shadow rendering on terrain in Orbiter...well, it sucks. It's pretty glitchy because all it can do is try to project the profile of the car as a 2D plane oriented to the local normal. The suspension animations of the car are similarly hamstrung because they are based on the orientation of the touchdown points to infer strut displacements.
All the cars I've had do. (except when driving along a slope) Think that is because of the Caster angle?
It's not particularly easy to model the effect of caster on the steering, and as you say caster doesn't always work to resume straight travel unless you are on a more or less level road. Trying to manage the steering with a control definition would turn the wheel too quickly, and the sudden change of angle would cause skid when it normally wouldn't. Slowing that down with a delay made the steering very sluggish. Making incremental changes to the steering angle seems to work nicely.
 
Shadow rendering on terrain in Orbiter...well, it sucks. It's pretty glitchy because all it can do is try to project the profile of the car as a 2D plane oriented to the local normal. The suspension animations of the car are similarly hamstrung because they are based on the orientation of the touchdown points to infer strut displacements.

It's not particularly easy to model the effect of caster on the steering, and as you say caster doesn't always work to resume straight travel unless you are on a more or less level road. Trying to manage the steering with a control definition would turn the wheel too quickly, and the sudden change of angle would cause skid when it normally wouldn't. Slowing that down with a delay made the steering very sluggish. Making incremental changes to the steering angle seems to work nicely.
Makes sense.:salute:

The voice of experience(y)
 
I sorted out the transition issue between the static and dynamic models. I was calculating both forces simultaneously and comparing them, intending to apply the lesser of the two. But what I forgot was that with the vehicle dynamics produced by the active model affected the inputs to the calculations of the other model, so the force comparison was never correct. I fixed that, so now I have static and dynamic wheel steering forces again.

Also, doing some more thinking, it occurred to me that my idea of using a spring displacement model for lateral forces of steering on the tire actually has a physical analog - the shear modulus of rubber.


I might be able to relate my (currently) ad hoc lateral stiffness to properties of rubber and wheel contact area. As long as I apply critical damping this should work.

EDIT: Yep, it seems to work beautifully. Using a shear modulus for rubber with a realistic contact patch area and tread height yields an effective stiffness very close to what I applied through trial-and-error. Physics and engineering FTW!
 
Last edited:
@JMW It seems that positive caster is in fact a necessary thing in this model. I was trying to zero the steering angle by hitting keypad 5 (mapped over the kill rotation), but the sudden change in wheel angle sends the steering wheels into a skid instantly. So I made a little caster function that slowly reduces the steering angle back to 0 absent any other steering inputs, and that seems to make all the difference. Thanks for putting that thought in my head!
 
  • Like
Reactions: JMW
Great! Yellow plane, blue car. I hope the next one should be a simple red (or green) boat with a small damping of touchdown points to simulate the rocking on the water waves. We need a complete collection of vehicles :)
 
Back
Top