I want to animate a object using lua. I know this is possible because in the gambler 500 scenarios to simulate the trash being picked up. I want to make it so when you enter the lua trigger an object moves from one spot to another. Any help is appreciated!
The code for animating the trash in the Gambler 500 scenarios is in the file BeamNG.drive\gameplay\missionTypes\scatterPickup\customNodes\scatterAnimatorNode.lua, it might be useful as a reference. But basically it just calls the setPosition() function on the objects every frame (in onPreRender) to move them along a path. This will not really work with objects that have collisions though.
I don't need it to have collisions, how could i make an object go from one coordinate to another animated? --- Post updated --- like a person going between three coordinates randomly.
You need to use "setPosRot" function to move the object. If you are just doing something like a straightline, you need to make a function that receives a starting, and an end point. Then the function should just move it every frame update until it reaches your end point. Keep in mind this is a very simplified explanation, and you would need to do stuff like Lerping etc to make it appear smooth and not be jittery