Edit: I just did some calculations and found that I can make it work somewhat efficiently around corners but only under 45 mph, but I will be using this code for a "Driver's Assistance" mod. I'm not gonna be working on this anymore due to the technical challenges with the game (needs an extreme amount of CPU power to make it work properly). But if anybody would like to try out what I've made so far, you can now give it shot! Only ETK 800 Only works in straight lines Can detect both dynamic (vehicles) and static objects Doesn't work well with small objects and only detects objects in path of raycasts If it's not working for you, press Ctrl + L to reset Lua. Github repo here: https://github.com/angelo234/aeb_angelo234
It only works with the ETK 800 car so it won't work with other cars and it should work right away (you'll see rays shooting out of the front of the car)
Wait you don't see the rays being shot out on the top of the windshield? I downloaded my uploaded mod and I see the rays. Well if it works then that's what counts
I only have ReShade and PostFX which both only have an overlay...the first time I installed it it worked, then I restarted the game and it was gone --- Post updated --- wait...no *facepalm*, I edited the lua so that it doesn't shoot the rays my brain is broke
If you want to make it work for another car, you first need to unzip the mod. Create a folder in the "mods" folder called "unpacked" and place the "aeb_angelo234" folder in there. Then open the "aeb_angelo234" folder and add a folder inside the "vehicles" folder with the name of the car (in this case "etkc"). And add a folder inside the "etkc" folder and name it "lua". And then copy and paste my "aeb_angelo234.lua" file from the "etk800/lua" folder into that new "lua" folder. So the file directory should look like this: "mods/unpacked/aeb_angelo234/vehicles/etkc/lua/aeb_angelo234.lua"
Open aeb_angelo234\scripts\aeb_angelo234\extension.lua Replace Code: hit = castRayDebug(origin, dest, includeTerrain, renderGeometry) with Code: hit = castRay(origin, dest, includeTerrain, renderGeometry)
i've done some testing and: It sometimes prevents from launching the car if your car is directed at a building it stops collisions up to ~95 kph/60 mph, anything more and you slam into the thing in front at low speeds i'll try porting it to other cars
Just like IRL. Idk if the speed matches but at X speed, the point is no longer to prevent the crash but to minimize how bad it will be.
Yeah, the algorithm I used to cast rays is pretty crappy honestly. If you can, you can try to change some of the parameters to make it shoot lower, in other directions, and from different positions however else you want. If you can find a way to find the direction vector of the car without influence from the car rolling and pitching under braking, then you wouldn't need to be shooting rays into the sky, since they point parallel to the ground under braking lol.
NU UHHH I WAS THINKING THIS SHOULD HE IN THE GAME FOR LIKE A MONTH NOW AND SOMEONE DONE IT THANK YOUUU --- Post updated --- I know rn it’s still experimental but the only issue rn is sometimes it brakes too late and I end up slamming into the vehicle in front at me even if I’m going 30 mph maybe add more of the dot thing (ion know the name lol) to more in front of the car
I'm not gonna be revamping this highway AEB system code. But I just did some calculations (I had doubts in the past without doing calculations and someone else was supposed to work on this system but it seems like they aren't working on it now) and found that I can actually use this existing code with modifications to make an improved automatic braking system that can work around corners but only under 45 mph ish and still be somewhat efficient. And so I'm actually going to be using some of this code for my "Driver's Assistance/Parking Aid" mod.