Can i get unit current speed?
Moderators: hoijui, Moderators
Can i get unit current speed?
I have looked through AI interface and all i can get is unit max speed. Is there some way to get unit CURRENT speed? Actually i need to know if unit is moving or not. Scanning its command queue for MOVE command is not tasty for me. Also i don't know if it will work for allied teams.
Re: Can i get unit current speed?
Unit.h does not have a field speed or current-speed or something.
How i think it works:
For each frame, the engine calculates how far the unit will get, according to its move-type, the terrain, a limit that says, do not move faster then unit X, ...
so the current speed changes each frame, but it is not saved in a variable, and you could just as well calculate it by tracing the units position. There should be little overhead there.
How i think it works:
For each frame, the engine calculates how far the unit will get, according to its move-type, the terrain, a limit that says, do not move faster then unit X, ...
so the current speed changes each frame, but it is not saved in a variable, and you could just as well calculate it by tracing the units position. There should be little overhead there.
Re: Can i get unit current speed?
Isn't in simulation code it is calculated anyway? Just store it in a unit and expose to public. Calculation of speed per each AI type is stupid (if they really needed this info).
Re: Can i get unit current speed?
FYI, Kloot was so responsive that added this possibility in master with http://github.com/spring/spring/commit/ ... e3c96c30f8 commit.
Re: Can i get unit current speed?
Kloot is awesome !