Jump to content

Recommended Posts

Posted

I'm trying to export data through Export.lua file. I read the example but couldn't find a function returning the velocity of all the units. Therefore, I wonder if I can manually calculate the velocity base on the difference between the position in each frame. In order to calculate the velocity, I have got to know the time between each simulation frames.

Is it a constant value like 60? Or is it the actual FPS of the game?

And are there other ways to get velocity of an object by its ID in Export.lua?

Thanks for all the help!

  • Solution
Posted

My experience with export is limited, but IIRC there is no "schedule function" to make sure something runs in X seconds from now or anything like that. But what you can do is use onSimulationFrame to check the time between it was last run and you can then execute functionality every x seconds rather than every single frame. 

It might aim for 60, but its best to sample the time each time it is run and check the difference. 

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted
16 minutes ago, Grimes said:

sample the time each time it is run and check the difference.

Thanks! I find a function called,

LoGetModelTime() -- returns current model time (args - 0, results - 1 (sec))

and it do return the actual time!

Posted

On your client side instance it will depend on your FPS, on a dedicated server its a fixed time, 0.0154 the last time i checked.

Creator & Developer of XSAF ::An AI model that wants to kill you, and needs no help from humans.

Discord: PravusJSB#9484   twitch.tv/pravusjsb  https://www.patreon.com/XSAF  https://discord.gg/pC9EBe8vWU https://bmc.link/johnsbeaslu

Work with me on Fiverr: https://www.fiverr.com/pravusjsb

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...