Hello! I was wondering if it's possible to access physics FPS from Lua. I'd like to have a lot of cars spawned in on my map, but that naturally has a huge impact on performance. Ideally, I'd set physics FPS for distant cars to a lower value and increase it as I get closer, but if that's not something currently exposed to Lua any way to get a bit more performance when having tons of cars would work. If car transforms/nodes don't change, does the engine skip calculations? Could I gain more performance by "freezing" vehicle nodes temporarily? Is that something that happens today? Thanks!
Way back, I think RoR had something similar to this... basically the vehicle would be frozen until you got close enough to interact with it, then it would be loaded and run in the physics engine. I do not think that Beam presently does this, although I know it has been discussed. What all it would require I am unsure. I would think that it should be possible in some way, but I am just unsure how you would go about doing it.
I'm pretty sure this is doable as kissmp does something similar (disabling physics for far away vehicles)
I know that traffic vehicles used to have disabled triangles, thermals and self-collision until they crashed, however I don't think that's a thing anymore, it could have been too buggy or didn't improve performance enough. If they did this instead of freezing the whole car then probably it's not a good idea, but why? No idea.
Because KissMP is a multiplayer mod it's able to handle all connections meaning that if a user is far away for example, no data will be sent to the client (ie you). There's no way to actually do this from Lua itself, all the data is handled by the server therefore it can decide whether to send data or not.
The physics update rate is fixed and can't be changed at runtime. Even it that was possible, it wouldn't be of any use as the vehicles would simply explode as soon as you changed that value.