Profile image

Coordinate based FT AI

104k winterro  one month ago

So i have figured out everything exept the steering. I mean everything

I have tried using

Latitude, Longitude , lat(target), long(target) to find the angle(aim) and heading.

It always ends up ocilating on the longitude line for some reason.

but clearly this isn't working, cause it doesn't work. how would you do it, and if possible as barebones as possible, as this caveman just spent 4 hours grinding himself into a wall, going nowhere.

  • Log in to leave a comment
  • Profile image
    149k KSB24

    it seems chaning the expression of aim into atan2((long - Longitude), (lat - Latitude))
    and steer into sin(aim-Heading) making the whole thing worked just slightly better

    one month ago
  • Profile image
    104k winterro

    @KSB24 It still doesn't work, it just keeps going north at exactly 000

    The code works, its just the atan2

    asin((long - Longitude) / pow(pow(long - Longitude, 2) + pow(lat - Latitude, 2), 0.5))

    doesn't work, it breaks after the first checkpoint and keeps going north

    atan2((long - Longitude), (lat - Latitude))

    also doesn't work, this one also breaks after the first checkpoint, but goes insane ans starts doing the sinus curve.

    +1 one month ago
  • Profile image
    104k winterro

    @KSB24 yeah, i have used that. I tried using a different code cause it couldn't stop it from ocolating on a single line in incremental of 22.5 degrees

    Turning it away from the target point broke everything.

    +1 one month ago
  • Profile image
    149k KSB24

    Have you considered using "atan2"? Not gonna lie, this function helped me alot for doing the exact same thing as aim you're trying to do right now.

    one month ago
  • Profile image
    104k winterro

    @KSB24 You have been doing this for a lot longer than me, is it possible if you could help lend me a hand?

    If yes, how would i go about creating just a very simple variant of this?

    I have tried using both sinus and tan, to use latitude and longitude as one big triangle and getting the angle from that, but that clearly doesn't work. The best thing i got is an annoying code that only works going away from the target and inverts when trying to get closer. swapping lat and long didn't help.

    It is a mess cause of all the drama, but its here if you wanna take a look at it, cause i really cannot find a sollution for the steering issue.

    +1 one month ago