Profile image

how to find target's speed?

1,456 Amirabadi  3.0 years ago

Hello

I'm making a text that should change depend on target's speed but i cannot find proper funky trees for it. for example i have tried to use this code i made but it does not work look below:

(this code suggested to show speed of a plane moving on a surface without changing altitude like tankers but i need a code that can also show speed of moving plane with different altitude in time)
sqrt((sin(rate(TargetHeading)) * (TargetDistance + rate(TargetDistance))) + (pow((TargetDistance + (cos(rate(TargetHeading) * TargetDistance))), 2)))

I don't know I used my professor's note to make it but it didn't make sense. I test it and the result was that It raised when targets get distance.
please if you can correct it or have another code please help me.


i think it take a lot to find proper code.

  • Log in to leave a comment
  • Profile image
    1,456 Amirabadi

    @DankeOlli thank you

    1.7 years ago
  • Profile image
    210 DankeOlli

    This is an old Thread but, I tried to figure out the same thing. I found it pretty handy to create single Variables for the movement along each axis and combine them in an additional variable as @snowflake suggested.

    1.7 years ago
  • Profile image
    1,456 Amirabadi

    @SnoWFLakE0s yeah that another true story but ishuax idea true
    Thanks for spending time teaching me more intresting funky trees
    Are you student?

    3.0 years ago
  • Profile image
    67.1k SnoWFLakE0s

    Try doing the trigonometry:

    1. Find target position components in the x, y, and z axis
    2. Apply rate() to all of them to obtain x / y / z target speed
    3. Perform vector addition
    4. You now have your target velocity vector.
    3.0 years ago
  • Profile image
    1,456 Amirabadi

    @Huax yeah after try and error i made a right code
    Thanks a lot for spending time teach me new things

    3.0 years ago
  • Profile image
    1,411 Huax

    Can you go check the post, since a long expression will almost always contain spelling problem. Variable system is awesome for this reason.

    3.0 years ago
  • Profile image
    1,456 Amirabadi

    @Huax sorry but it does not work can you please send a proper text that i can copy and paste

    3.0 years ago
  • Profile image
    1,456 Amirabadi

    @Huax does it have two pow at first?

    3.0 years ago
  • Profile image
    1,456 Amirabadi

    @Huax thanks i will test it and check your post
    Thanks

    3.0 years ago
  • Profile image
    1,411 Huax

    Also, I have a build with advanced targeting which is
    All About your Target
    You can check it out as it includes target maximal acceleration/g, maximal altitude/velocity, current velocity/altitude, current heading/pitch angle.

    3.0 years ago
  • Profile image
    1,411 Huax

    I don’t understand why your codes are like that but anyways.
    So the relative Alt/Lat/Longitude to you is
    Lat: cos(TargetHeading)cos(TargetElevation)TargetDistance
    Long: same as Lat except it is sin(TargetHeading) instead of cos
    Alt: sin(TargetElevation)*TargetDistance

    However, you are moving aren’t you?
    So we need to add your own displacement there
    Target’s absolute position is
    well, basically the relative ones add to Lat/Long/Altitude

    Then you square root the sum of their square.
    You final equation will be

    TargetVelocity=
    pow(
    pow(rate(Latitude+cos(TargetHeading)cos(TargetElevation)TargetDistance),2)
    +pow(rate(Longitude+sin(TargetHeading)cos(TargetElevation)TargetDistance),2)
    +pow(rate(Altitude+sin(TargetElevation)*TargetDistance),2)
    ,1/2)

    3.0 years ago
  • Profile image
    1,456 Amirabadi

    @SnoWFLakE0s

    please help

    +1 3.0 years ago