TEMPEST.114 Posted February 10, 2023 Posted February 10, 2023 (edited) Here is a copy of the embedded script: function ShowTankerVelocity() local function Show() local velocityVec3 = Group.getByName("KC135MPRS"):getUnit(1):getVelocity() local velocity = ( velocityVec3.x ^ 2 + velocityVec3.y ^ 2 + velocityVec3.z ^ 2 ) ^ 0.5 local knots = velocity * 1.943844 local text = string.format("%dkts", knots) trigger.action.outTextForCoalition(2, text, 1, true) return timer.getTime() + 1 end timer.scheduleFunction(Show, nil, timer.getTime() + 0.1) end ShowTankerVelocity() This is called after 10 seconds by a trigger in the ME. The tanker reports on the F10 map on the grey/blue box that it's stable at 350 knots ( @SUNTSAG note the label error - MPH is incorrect, but also giving the same as KNOTS - and the rounding errors.) However, the speed reported by 'getVelocity()' changes every frame. Such that it's bouncing between 295 and 415. Attached is the miz, the script and a link to a YT video showing the error. https://www.youtube.com/watch?v=1PwQ8FngCHs This should be returning a stable 350 - it's not. getVelocityBug.miz getVelocityScript.lua Edited February 10, 2023 by Elphaba
TEMPEST.114 Posted February 10, 2023 Author Posted February 10, 2023 UPDATE: Same units, same script, same everything else EXCEPT A DIFFERENT MAP (Caucasus) and this time it works perfectly... WTH is going on? What am I missing? getVelocityBug_Caucasus.miz
Flappie Posted February 10, 2023 Posted February 10, 2023 (edited) The wind is not the same in your missions: pretty windy over Marianas, no wind over Caucasus. Test1 : I had the AWACS fly in a straight line, heading north, at a constant speed. Wind blows south at a speed of 18 knots. When pressing F2, I read: IAS = 389 knots. TS = 430 knots (press Ctrl+Y to read TS) Lua = 411 knots, which is pretty accurate (430 - 18 = 412). Test 2 : I watched the AWACS TS perform a turn with no wind at all: TS=426 / Lua=425 Test 3 : I watched it perform an orbit with no wind at all: TS=430 / Lua=429 Test 4 : I watched it perform an orbit with a 18 knots wind: TS=430 / Lua oscillates between 410 and 447 kts Considering 410+18 = 428 and 447-18 = 429, it seems the Lua script works very well. AWACS true speed.trk Edited February 10, 2023 by Flappie 1 ---
TEMPEST.114 Posted February 10, 2023 Author Posted February 10, 2023 1 minute ago, Flappie said: The wind is not the same in your missions: pretty windy over Marianas, no wind over Caucasus. Test1 : I had the AWACS fly in a straight line, heading north, at a constant speed. Wind blows south at a speed of 18 knots. When pressing F2, I read: IAS = 389 knots. TS = 430 knots (press Ctrl+Y to read TS) Lua = 411 knots, which is pretty accurate (430 - 18 = 412). Test 2 : I watched the AWACS TS perform a turn with no wind at all: TS=426 / Lua=425 Test 3 : I watched it perform an orbit with no wind at all: TS=430 / Lua=429 Test 4 : I watched it perform an orbit with a 18 knots wind: TS=430 / Lua oscillates between 410 and 447 kts Considering 410+18 = 428 and 447-18 = 429, it seems the Lua script works very well OK. AWACS true speed.trk 57.32 kB · 0 downloads Then it's a bug - because Velocity is NOT groundspeed.
PravusJSB Posted February 10, 2023 Posted February 10, 2023 Confirmed that this is something that needs to be looked into, I'll post it in the beta forums for you @Elphaba 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
Flappie Posted February 10, 2023 Posted February 10, 2023 4 minutes ago, PravusJSB said: Confirmed that this is something that needs to be looked into, I'll post it in the beta forums for you @Elphaba Why bother? I can report it internally. ---
TEMPEST.114 Posted February 10, 2023 Author Posted February 10, 2023 (edited) 3 minutes ago, Flappie said: Why bother? I can report it internally. If this is GROUNDSPEED (which is wrong), then where is the figure on the AWACS display coming from? Because THAT'S what getVelocity() should be reporting. BTW is would be REALLY NICE to actually have a GROUNDSPEED we can pull from the scripting engine. Edited February 10, 2023 by Elphaba
PravusJSB Posted February 10, 2023 Posted February 10, 2023 3 minutes ago, Flappie said: Why bother? I can report it internally. Well sir, this is a community and I have the privilege to do so and indeed have done. Put your feet up. 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
TEMPEST.114 Posted February 10, 2023 Author Posted February 10, 2023 11 minutes ago, Flappie said: Why bother? I can report it internally. Are you going to tag this thread as 'reported' then?
funkyfranky Posted February 13, 2023 Posted February 13, 2023 (edited) Sorry, but nothing is wrong here except maybe as false expectation as to what the getVelocity function returns. This indeed returns the ground speed (GS). The speed shown in box on the F10 map is true airspeed (TAS). As soon as you accept that, all the numbers make perfect sense. TAS is constant and GS (=TAS+WIND) varies as the aircraft travels in the direction of the wind or in the opposite direction (or anything in between). This also explains the "differences" between the maps, because on Caucasus mission the wind is zero and therefore TAS=GS. Edited February 13, 2023 by funkyfranky 1 A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
TEMPEST.114 Posted February 14, 2023 Author Posted February 14, 2023 6 hours ago, funkyfranky said: Sorry, but nothing is wrong here except maybe as false expectation as to what the getVelocity function returns. This indeed returns the ground speed (GS). The speed shown in box on the F10 map is true airspeed (TAS). As soon as you accept that, all the numbers make perfect sense. TAS is constant and GS (=TAS+WIND) varies as the aircraft travels in the direction of the wind or in the opposite direction (or anything in between). This also explains the "differences" between the maps, because on Caucasus mission the wind is zero and therefore TAS=GS. 'False Expectation'? How about it's because of crummy naming conventions? If it's groundspeed it should be 'getGroundspeed()' !!!!! I don't know about the rest of the people struggling with this unsupported API, but I'm not a mind reader. If we can't rely on the name to describe what it does in lieu of proper and up-to-date documentation, the ED need to be better at naming things so they describe themselves properly. As it stands, I'd already worked out if I vector subtract the wind from it I get an approximate value. But come on...
funkyfranky Posted February 14, 2023 Posted February 14, 2023 (edited) First, I totally agree with you @Elphaba that the lack of proper documentation is very unfortunate to say the least. However, the naming of the getVelocity function is perfectly fitting as it returns exactly what the name suggest, i.e. the velocity by its very definition (rate of change of position with respect to time). And since you can apply the function not only to aircraft but also to ground vehicles and ships, naming it getGroundspeed would be a bad choice IMO. Also, I am not 100% sure, but I think ground speed only refers to the speed in the 2D horizontal plane, i.e. a helicopter moving just vertically up or down would have a ground speed of 0, while its velocity would be greater than 0. And that is what getVelocity would return. If you want to get the ground speed from the getVelocity function you would need to project in onto 2D, i.e. GroundSeed=( velocityVec3.x ^ 2 + velocityVec3.z ^ 2 ) ^ 0.5 Edited February 14, 2023 by funkyfranky 1 A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
Recommended Posts