Is there a way to set vehicle velocity from Lua? I mean not just apply some force to the vehicle or throttle up, i mean straight up setting the velocity. I know there is a obj:getVelocity() method, so logically there should be a obj:setVelocity(), but this one either does something else rather than what it says on the tin, or i don't know how to correctly use it. If there is no such method, then is there a method to actually apply force to the vehicle (again, not through the wheels)? Same two questions for rotation. Any help would be greatly appreciated.
A bit of a bump. This is for the BeamNG multiplayer project (the most popular topic here). We currently just set the position of a vehicle to the new location when the data arrives. That works, but it's extremely wanky and jittery, also doesn't really allow for collisions. The ability to just set the velocity of the vehicle will help preserve the physics between the states so that collisions work and just overall prettiness of the experience. It's very strange, but the obj:setVelocity() method seems to do nothing, yet the console doesn't get angry that there is no such method, so i guess i just don't understand something crucial here. It may be connected that I'm inexpirienced when it comes to lua. Again, any help would be appreciated.
Hey Short answer, no you can't set node velocities (and not just because it's not exposed, but because it's technically not possible). Same goes for setting rotation, you cannot change rotation without causing a full reset. What you can do is apply thrust to individual nodes. Take a look at thrusters.lua for some example usage. (obj:applyForce)