@ThomasRoderick oh, i even haven't thought about that! i set 5 m/s muzzle velocity and it seems that they haven't, so that part of code is harmful. I will fix that in future, but you already can change 0.05 values to 0 using notepad++'s text finder/replacer
But anyway, this code will be used in turrets for tank cannons, as their projectiles are physificated
@PlanariaLab yes, i used rotation matrix and Euler angles, and then "debugged" final result by adjusting some +- signs, which is not intended by math methods. Maybe there were some mistakes, maybe the game uses left-handed CS and Longitude = -X in fact, i dont know(in fact i get left-handed system after rotation, and just put - before relative X so it become right-handed).
You can use my code, but as there no custom variables in the game, it seems messy and so hard to be reversed. I want to finish work with this, and then post a pdf sheet with detailed explanation how it works.
Super-short instruction how to do rotation:
1)find out sequence of rotations, in SP its ZXY =Heading+Pitch+Roll
2)multiplie rotation matrixs, related to the rotation axes, in opposite direction! so for SP this direction is YXZ, you can find that matrixs in wikipedia and use mathcad etc for multiplying
3)multiply resulted from 2) matrix on column matrix (XYZ) where XYZ - old coordinates and you will get column matrix (xyz) with new coordinates
4)Theoretically, you have to input negative(not in-game sign, but positive = CCW in right-handed CS and CW in left-handed) angles in it, but practically i adjusted signs of angles manually
@Grob0s0VBRa sure that can exist, but you're right that will make code longer.
If you need some special position, try to choose closest one prefab, set min/max angle limits both on one side relatively to 0 (for example: (min +20 max +60) or (min -75 max -30)) and in the end of generated code change 0 to some value between min and max. In the hangar turret still will be directed according straightly to the prefab, but as you wanted during flight.
@joshuaW
hello again. I'm back to auto aiming now, and still can not catch what you did with vertical aiming.
(see your answer beneath)
Which way global CS affects all this, if at the stage of aiming angle definition we works fully in relative CS?
Why you calculating vehicle top vector, if in relative CS it's a constant {0,0,1}?
I've tryed using just formula for angle between vectors: cos(a) = dot product / product of lengths, but the result is just barrel shaking.
P.S. i would be grateful if you can contact with me in discord for more convenient communication: kerved#9113
@ThomasRoderick sure you allowed, moreover, i did explanation sheet how to code this. Only thing not mentioned there, that it is convenient to additionally rotate relative CS, so positive relY looking forwards as gun, not as cockpit(90 degree rotation dont require any additional math, just swap expressions between X Y and Z at the page 6)
explanation sheet: https://pdfhost.io/v/ynujis.r2_Explanationpdf.pdf
Thanks to all, who interested in it, but due to some life changes IRL work on auto aim is freezed on undefined time.
I hope one day i can return to it, and re-make with those all new features, added to game
@Zuikaku also, if you set muzzle velocity too low for cannon, far targets will come out of range earlier, than their aim square disappears. This may cause problems with aiming.
@JoshuaW can you pls explain your method for vertical rotator? i don't have neither time and desire to do reverse-engineering, but it looks interesing.
@SnoWFLakE0s code string long because of missing custom variables in FT. In minimized view, where code parts logically replaced with a single word, it is much more clear. As i promised before, i will publish detailed explanation how i come to this and how to assemble your own code, but at this moment i have no enough free time to do that qualitatively, so I put it off for the future, and so far showed only the capabilities of the code.
@SnoWFLakE0s it seems that you just don't understand what i'm doing.
I trying to make an auto aim turret for bomber
bomber turret has it's own coordinate system. When axises of turrets own system are parallel to the global axises(bomber's PitchAngle=0 and RollAngle=0) you can use TargetElevation for turrets own YZ plane rotator input, and deltaangle(Heading, TargetHeading) for turrets own, "local" XY plane rotator.
But, as you said, TargetHeading and TargetElevation are completely unaffected by airplane rotation, and when bomber rolls/pitches, turret rotators rolls/pitches with whole aircraft, and turrets keep on aiming like plane's pitch and roll are full zero! I clearly understand, that TargetHeading and TargetElevation are unaffected by aircraft rotation, andit's a problem
ONE ERROR CATCHED!
In the game, positive direction of TargetHeading is CW, while in right-handed coordinate systems positive rotation is CCW.
When i changed (TargetHeading) to (-TargetHeading) X and Y coordinates became working correctly on USS Tiny, while before this X arrow was showing Y moving on USS Tiny.
Unfortunately, i still see some bugs with Z coordinate
@SnoWFLakE0s 0)I already wrote 1 and 2, and then paid attention to that link you gave. 0.1)Have you checked my pdf? i has there that formulas that you gave 0.2)There said, that X=Latitude and Y=Longitude, but your FT guide says that X=Longitude and Y=Latitude. I guess here can be a problem, i will try to swap them, then 1)TargetHeading is relative by position, but it is global by rotation, as don't deal with your aircraft's heading/pitch/roll 2)based on 1), deltaangle(Heading,TargetHeading) also dont deal with aircraft rotation 3)There just long formulas, but logic is simple
P.S. I will contact you in discord, if swapping of Longitude/Latitude will not give positive result.
@og31S i can't say anything about red rotator at this moment, but i paid attention, that at USS Tiny X axis reacts on forward-backward movements, but Y axis has to react on it, because i defined Y axis as "looking forward"(there is a picture in the end of PDF). I think i will look for math forums tomorrow, and maybe ask there additional explanations about coordinate systems rotating
@Scharnhorst, hello! I haven't played SP several years, but thanks to this your craft i have mentioned that FT was added to the game, and i started discovering it. For current moment your code seems too complicated for me, but as i realise from comments, your current code doesn't count with acceleration, instantaneous speed only. I dont know why it is, but i want to suggest you using a Laplace transform, maybe it will help to predict target movement using not only speed, but acceleration too?
https://en.wikipedia.org/wiki/Laplace_transform
@BBCP117 video - no, but maybe i will make text guide later
+3
+2https://www.simpleplanes.com/a/VQQ7ri/Puto-40-75-Upgraded
@Star737 i did it
+2https://www.simpleplanes.com/a/8j4s4I/GAZ-66-with-ZU-23-2-Funky-Treeed
@ThomasRoderick oh, i even haven't thought about that! i set 5 m/s muzzle velocity and it seems that they haven't, so that part of code is harmful. I will fix that in future, but you already can change 0.05 values to 0 using notepad++'s text finder/replacer
+2But anyway, this code will be used in turrets for tank cannons, as their projectiles are physificated
@PlanariaLab yes, i used rotation matrix and Euler angles, and then "debugged" final result by adjusting some +- signs, which is not intended by math methods. Maybe there were some mistakes, maybe the game uses left-handed CS and Longitude = -X in fact, i dont know(in fact i get left-handed system after rotation, and just put - before relative X so it become right-handed).
+2You can use my code, but as there no custom variables in the game, it seems messy and so hard to be reversed. I want to finish work with this, and then post a pdf sheet with detailed explanation how it works.
Super-short instruction how to do rotation:
1)find out sequence of rotations, in SP its ZXY =Heading+Pitch+Roll
2)multiplie rotation matrixs, related to the rotation axes, in opposite direction! so for SP this direction is YXZ, you can find that matrixs in wikipedia and use mathcad etc for multiplying
3)multiply resulted from 2) matrix on column matrix (XYZ) where XYZ - old coordinates and you will get column matrix (xyz) with new coordinates
4)Theoretically, you have to input negative(not in-game sign, but positive = CCW in right-handed CS and CW in left-handed) angles in it, but practically i adjusted signs of angles manually
@Scharnhorst check this, please
+2https://www.simpleplanes.com/a/bzVzcg/Mad-Math-Funky-Road-Auto-aim-turret-for-planes
@Grob0s0VBRa sure that can exist, but you're right that will make code longer.
+1If you need some special position, try to choose closest one prefab, set min/max angle limits both on one side relatively to 0 (for example: (min +20 max +60) or (min -75 max -30)) and in the end of generated code change 0 to some value between min and max. In the hangar turret still will be directed according straightly to the prefab, but as you wanted during flight.
@DwiAngkasaAeronautics for "like tank turrent mount" – yes
+1@joshuaW
+1hello again. I'm back to auto aiming now, and still can not catch what you did with vertical aiming.
(see your answer beneath)
Which way global CS affects all this, if at the stage of aiming angle definition we works fully in relative CS?
Why you calculating vehicle top vector, if in relative CS it's a constant {0,0,1}?
I've tryed using just formula for angle between vectors: cos(a) = dot product / product of lengths, but the result is just barrel shaking.
P.S. i would be grateful if you can contact with me in discord for more convenient communication: kerved#9113
@ThomasRoderick sure you allowed, moreover, i did explanation sheet how to code this. Only thing not mentioned there, that it is convenient to additionally rotate relative CS, so positive relY looking forwards as gun, not as cockpit(90 degree rotation dont require any additional math, just swap expressions between X Y and Z at the page 6)
+1explanation sheet:
https://pdfhost.io/v/ynujis.r2_Explanationpdf.pdf
@ThomasRoderick as i remember no, but this was designed almost 5 years ago, so maybe...
+1Explanation has been added!
+1@Scharnhorst
+1@SnoWFLakE0s
@DenizLion thanks, all work i made was just for having a grounds for publishing this meme
+1@Scharnhorst i think you can be interested in it.
+1@Nerfaddict what about investments?
hmm, can i call a user here in such way?
+1@SnoWFLakE0s
@TheFlyingPlane21 that was added relatively recently, in 1.9 or around that
+1@RAF1 maybe, if we talk about the same art, where was castle with wings and tail from b-17
+1please add boolean shortestAngle to joint rotator
Thanks to all, who interested in it, but due to some life changes IRL work on auto aim is freezed on undefined time.
I hope one day i can return to it, and re-make with those all new features, added to game
@Thelegitpilot13 maybe... haven't tested it after last update...
@Zuikaku Now should work fine
@Fellex for tank turret as you described
@Zuikaku also, if you set muzzle velocity too low for cannon, far targets will come out of range earlier, than their aim square disappears. This may cause problems with aiming.
@Zuikaku thanks for the report. At this moment i'm far away from my PC, but i'll try to fix this issue when i'm back home!
@MrGreen
i'm not a programmer, so i found C# and Windows Forms the easiest way to do this
@NightmareCorporation
sorry :c
@pg821
here is explanation how it works:
https://pdfhost.io/v/ynujis.r2_Explanationpdf.pdf
@pg821
here is explanation how it works:
https://pdfhost.io/v/ynujis.r2_Explanationpdf.pdf
@JoshuaW can you pls explain your method for vertical rotator? i don't have neither time and desire to do reverse-engineering, but it looks interesing.
@ToxyPilot
@SnoWFLakE0s code string long because of missing custom variables in FT. In minimized view, where code parts logically replaced with a single word, it is much more clear. As i promised before, i will publish detailed explanation how i come to this and how to assemble your own code, but at this moment i have no enough free time to do that qualitatively, so I put it off for the future, and so far showed only the capabilities of the code.
@YamatoAirlines sure
@EternalDarkness how many people can i tag so that wouldn't be a mass tagging?
@EternalDarkness can you pls swap second and first screenshot and reestablish post?
@PointlessWhyshouldi this build just a test car, the main purpose of this - code of the turret
@SnoWFLakE0s @AtlasAviation @BagelPlane @Gluck @Highground @ChrisChrisThePy @WrongFlyer @IzzyIA @BagelPlane @og31S @goboygo1 @ThomasRoderick @Thelegitpilot13 @Scharnhorst
@SnoWFLakE0s it seems that you just don't understand what i'm doing.
I trying to make an auto aim turret for bomber
bomber turret has it's own coordinate system. When axises of turrets own system are parallel to the global axises(bomber's
PitchAngle=0
andRollAngle=0
) you can useTargetElevation
for turrets own YZ plane rotator input, anddeltaangle(Heading, TargetHeading)
for turrets own, "local" XY plane rotator.But, as you said,
TargetHeading
andTargetElevation
are completely unaffected by airplane rotation, and when bomber rolls/pitches, turret rotators rolls/pitches with whole aircraft, and turrets keep on aiming like plane's pitch and roll are full zero!I clearly understand, that
TargetHeading
andTargetElevation
are unaffected by aircraft rotation, and it's a problemONE ERROR CATCHED!
In the game, positive direction of
TargetHeading
is CW, while in right-handed coordinate systems positive rotation is CCW.When i changed
(TargetHeading)
to(-TargetHeading)
X and Y coordinates became working correctly on USS Tiny, while before this X arrow was showing Y moving on USS Tiny.Unfortunately, i still see some bugs with Z coordinate
Here right meanings:
Y=Latitude
X=Longitude
So this is correct in my code
@SnoWFLakE0s
0)I already wrote 1 and 2, and then paid attention to that link you gave.
0.1)Have you checked my pdf? i has there that formulas that you gave
0.2)There said, that X=Latitude and Y=Longitude, but your FT guide says that X=Longitude and Y=Latitude. I guess here can be a problem, i will try to swap them, then
1)
TargetHeading
is relative by position, but it is global by rotation, as don't deal with your aircraft's heading/pitch/roll2)based on 1),
deltaangle(Heading,TargetHeading)
also dont deal with aircraft rotation3)There just long formulas, but logic is simple
P.S. I will contact you in discord, if swapping of Longitude/Latitude will not give positive result.
@og31S i can't say anything about red rotator at this moment, but i paid attention, that at USS Tiny X axis reacts on forward-backward movements, but Y axis has to react on it, because i defined Y axis as "looking forward"(there is a picture in the end of PDF). I think i will look for math forums tomorrow, and maybe ask there additional explanations about coordinate systems rotating
@Scharnhorst, hello! I haven't played SP several years, but thanks to this your craft i have mentioned that FT was added to the game, and i started discovering it. For current moment your code seems too complicated for me, but as i realise from comments, your current code doesn't count with acceleration, instantaneous speed only. I dont know why it is, but i want to suggest you using a Laplace transform, maybe it will help to predict target movement using not only speed, but acceleration too?
https://en.wikipedia.org/wiki/Laplace_transform
@MEGANOOB maybe a little
@SPS13 sure
@Imperium cup holder not included in the complete set, but you can buy it separated only for 9.99
video of tests (in VK)
http://vk.com/video?z=video244740054171609351%2F1a2104f6fb956cdc18%2Fplupdates
http://vk.com/video?z=video244740054171609418%2F43e4c18ace994610e5%2Fplupdates
so, i do it myself
https://www.simpleplanes.com/a/q4QMm9/Bomber-NOW-WITH-BOMB-BAY-DOORS
@salvador3031 well, some of your planes looks like your namesake's paintings :D
25-b
https://www.simpleplanes.com/a/ofVRW3/Bomb-Artillery-Here-25-b-version