Hello, I'm experimenting with a scenario that makes use of 'fake' gravity, in order to get more mileage out of it than the default gravity is capable of. However, there seem to be some issues with using wind as an alternative, and I'm wondering if/how I can apply forces to a vehicle directly. Say, using applyForce()? Now, near as I can tell, I'll need to tap into vehicle lua in order to do that. And some examples exist of retrieving node/beam info (the cannon chapter of Senseless Destruction tracks the cannonball), and modifying it (Broken Truck assigns breakGroups to break), but I'm not having much luck personally assigning node references to variables. And of course the elephant in the room is: can applyForce be used to apply a force along a vector, instead of using node references? If not, I figure it should be possible to get the central, left, back, and up reference nodes and create forces between those for a full range of motion, but I'd rather apply the forces to all nodes (if it's not too processor intensive, as applying extreme forces to individual nodes may damage the vehicle) and I also want this to be functional for any type of vehicle (so the reference nodes can't be retrieved by their names). As always, any help is appreciated. -Occam
Recovery function finds camera position and pulls vehicle towards that position (when you hold down insert), if I have understand correctly, but that said I haven't read this lua too carefully. steamapps\common\BeamNG.drive\lua\vehicle\recovery.lua I have not got around to examine this and I have no idea how to implement it, but it at least sounds logical that you could use same method to pull vehicle towards certain point on map?
Not quite. Vehicle recovery just passively captures the vehicle's position and orientation from time to time. Then, when the recover button is pressed, the vehicle is repositioned and reoriented to the catalogued positions. If it were based on camera position, the system wouldn't work properly if the camera were rotated, and if it were done via force, the vehicle would probably continue coasting in the direction it was moving during recovery.
So, quick thought: what about using the nodegrabber as a reference? It applies forces, and as there are no new nodes being added to the jbeam, it must apply those forces according to a vector rather than a node reference. The only issue is that I have no idea where to find the nodegrabber in the game's files. Does anyone have any leads?
Alls i can say is that it's got to be in the game engine zip somewhere. That's all I know, that'd be logical, and we all know games are always designed 100% straight-forward and logically *sarcasm*. But, if anyone else surely knows, that will override this, for-sure. It's somewhere in the UI.
recovery.lua has line where it asks game engine to do query of game objects, lua\ge has game engine stuff, I would start looking trough there. loadHome in recovery.lua gives idea what to look from files in ge I would guess.