View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0002344 | Spring engine | Lua | public | 2011-02-09 07:14 | 2011-02-21 19:40 | ||||
Reporter | user744 | ||||||||
Assigned To | Kloot | ||||||||
Priority | normal | Severity | feature | Reproducibility | N/A | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 0.82.7.1 | ||||||||
Target Version | Fixed in Version | 0.82.7+git | |||||||
Summary | 0002344: Req: GetUnitSpeed (uID) -> returns number and StartMoving (speed) | ||||||||
Description | If I didnt miss anything, at the moment the only way to get a units speed is Spring.GetUnitVelocity which returns a vector. So to get the unitspeed as a number, you have to calculate the length of this vector. But there is still no way to know if the unit is driving forwards or backwards because the length is unsigned. Beside maybe comparing the speed vector with the heading vector. (checking if they point in same direction) This seems like a bit of unnessecaty calculations and iam not sure how accurate it would because you would have to do it at intervalls. Telling apart forward/backward movement is important for animations ie reverse walking animations or spin wheels backwards. So I think it would be good to have: Spring.GetUnitSpeed (unitID) it would return the unit speed as a number, compatible to the numbers in unitdef and if the unit is driving backwards it is negative. Or maybe signed speed could just be a fourth return parameter to GetUnitVelocity(), whatever is easier/better. In unit animation scripts there are the StartMoving() and StopMoving() callins. Maybe these callins could also include the units speed and the units wanted speed. So that you do not have to GetUnitSpeed and do not have to poll the speed in a loop to check for changes. Similiar to how to script.WindChanged ( number heading, number strength ) also includes heading+strength even though there is Spring.GetWind () too. It would make some scripts very simple ie: script.StartMoving (speed) Spin (Wheel, bla_axis, speed*somefactor) end | ||||||||
Additional Information | http://springrts.com/phpbb/viewtopic.php?f=21&t=25308 had previously made thread in forum in case someone was going to post its already possible | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
2011-02-21 18:45 |
kloot added something :) https://github.com/spring/spring/commit/3089a9da1769d3d9b1c42b74c5d29c852495240d |
Kloot (developer) 2011-02-21 19:39 Last edited: 2011-02-21 19:40 |
indeed (and I assume that change plus GetUnit{COB}Value(..., REVERSING) is enough to meet your modding needs) |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2011-02-09 07:14 |
|
New Issue | |
2011-02-21 18:45 |
|
Note Added: 0006423 | |
2011-02-21 19:39 | Kloot | Note Added: 0006424 | |
2011-02-21 19:40 | Kloot | Note Edited: 0006424 | |
2011-02-21 19:40 | Kloot | Status | new => resolved |
2011-02-21 19:40 | Kloot | Fixed in Version | => 0.82.7+git |
2011-02-21 19:40 | Kloot | Resolution | open => fixed |
2011-02-21 19:40 | Kloot | Assigned To | => Kloot |