Hey folks! I have tried for some time now to export vehicle and wheel motion from BeamNG. My goal would be to have vehicle position and rotation together with position and rotation of all the four wheels with a frequency of minimum 30hz. Things I've tried so far: Parsing the .rpl files and extracting data from there. Worked up to the point, that I got values for vehicle position and rotation, together with wheel transformations, but the motion looked quite off. Then I tried to use the datalogger .lua script from @Arcanox, but the frequency wasn't enough for me - the script only exported with 4hz. Going higher wouldn't export anything. Do you have any ideas, how this could be tackled?
A little update: Turns out, I did something wrong and lua does support higher rates of logging, so that's not an issue. I'm only struggling with exporting the right data. Vehicle position is working, but rotation as well as Node position and rotation seems not to be working. I guess I'm accessing the wrong data: Code: logLine( runningTimer, obj:getPosition().x, obj:getPosition().y, obj:getPosition().z, obj:getRotation().x, obj:getRotation().y, obj:getRotation().z, obj:getRotation().w, obj:getNodePosition("wheel_FL").x, obj:getNodePosition("wheel_FL").y, obj:getNodePosition("wheel_FL").z, obj:getNodeRotation("wheel_FL").x, obj:getNodeRotation("wheel_FL").y, obj:getNodeRotation("wheel_FL").z, obj:getNodeRotation("wheel_FL").w, ) For full reference I also uploaded the full .zip
The obj:getRotation() data needs to be put into a "quat" data type/class so the code becomes: Code: logLine( runningTimer, obj:getPosition().x, obj:getPosition().y, obj:getPosition().z, quat(obj:getRotation()).x, quat(obj:getRotation()).y, quat(obj:getRotation()).z, quat(obj:getRotation()).w ) As for the obj:getNodePosition function, it requires a node ID and not a string. And I did find a snippet of code you can use to get the position of each wheel from aeroDebug.lua: Code: for _, wd in pairs(wheels.wheels) do local pos1 = vec3(obj:getNodePosition(wd.node1) + obj:getPosition()) local pos2 = vec3(obj:getNodePosition(wd.node2) + obj:getPosition()) local middlePos = (pos2 + pos1) * 0.5 end But for the obj:getNodeRotation function, I'm not sure where you found it from since it doesn't exist... :\