I recently learned how to adjust brake torque & etc values in drivetrain using Lua... for example (from the Vehicle Lua console): Code: for a,b in pairs(drivetrain.wheels) do drivetrain.wheels[a].brakeCoreTemperature = 10000 end That works great for various brake related things. I can't get it to function the way I expected for frictionCoef though... I thought that I'd try and store the original value and then modify that value like this: Code: for a,b in pairs(drivetrain.wheels) do for x,y in pairs(b.sideBeams) do drivetrain.wheels[a].sideBeams[x].torsionStockFrictionCoef = y.frictionCoef drivetrain.wheels[a].sideBeams[x].frictionCoef = y.frictionCoef*2.6 end end And in fact these can be run separately on the console like this: Code: for a,b in pairs(drivetrain.wheels) do for x,y in pairs(b.sideBeams) do drivetrain.wheels[a].sideBeams[x].torsionStockFrictionCoef = y.frictionCoef end end for a,b in pairs(drivetrain.wheels) do for x,y in pairs(b.sideBeams) do drivetrain.wheels[a].sideBeams[x].frictionCoef = y.frictionCoef*2.6 end end After running them we can check the values and they look fine... but they don't change the behavior of the tires at all! I'm checking the values like this: Code: for a,b in pairs(drivetrain.wheels) do for x,y in pairs(b.sideBeams) do print("Current:" .. y.frictionCoef) print("Stock:" .. y.torsionStockFrictionCoef) end end I'm open to help with doing it this way or alternative methods. My intention is to replace some custom tires for my Wheelie Monster mod with a script which just applies special sauce to the rear tires automatically based on some criteria. For example, the script might check to see whether the "tire_sauce" part was equipped in the pickup_mod slot. That would help keep the tires up to date with the latest changes to the tires in the game as well as allowing a wider selection of tires and rims to be used...
Errr, um, the beams do not have a friction coefficient, it might be be in the table but its not used. You will have to find the nodes, and even then, it's a different problem than the brake torque values. The brake and torque stuff is continually sending new values to the core physics in drivetrain.lua, whereas node friction coefficient is only given to the core when the vehicle is initialized. It doesn't look like we currently have a way to dynamically set the friction coefficient from lua.
Thanks @Goosah. I think I started from the wrong place - I wanted to find where that value was kept after it was loaded from the jbeam so I dumped drivetrain.wheels[0] and looked through it. Those were clearly marked as "beams" but I didn't see it anywhere else. It was suggested to me to follow the data _in_ through jbeam_main.lua and/or jbeam_wheels.lua and see where that leads. That sounds like a better plan than the way I was doing it, so that's what I intend to try next. I'm OK with resending to physics (re-initialize/respawn the vehicle). I've assumed from the start that I might have to do that. It's fine because this will only kick in when new tires are equipped or when the user un-equips the "tire sauce" part.