Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Angle difference
#8
(01-31-2023, 09:29 PM)SMcNeill Wrote: From what I read, it appears you're looking for something like this to determine if they're on a collision course:

Code: (Select All)
PRINT collision(0, 10)
PRINT collision(10, 0)
PRINT collision(350, 0)
PRINT collision(0, 350)
PRINT collision(0, 11)
PRINT collision(11, 0)
PRINT collision(349, 0)
PRINT collision(0, 349)


FUNCTION collision (a, b)
    t = ABS((a - b + 360) MOD 360)
    collision = t <= 10 OR t >= 350
END FUNCTION

No the collision detection was being done with thePixelCollision code. The problem was what to do after collision was detected. Do I reverse the spider do I reverse both spiders, do I turn them same direction if head on but opposite direction if their headings almost the same.... 

I figured if both going in approximately same direction to turn one one way and the other the opposite but with my first angle diff code that didn't work maybe with code developed today. I kept getting spiders stuck or spinning, yuck!

Big spiders were setup to go faster than little ones so if on same heading they will collide because the big one overtook the smaller. That's when I needed to know the angle difference in their headings, to swerve the two apart. The angle difference problem had me stumped for awhile and my solution yesterday failed to stop the problems.

Anyway for spider collisions the solution was to just speed up both in direction they were going, looks about right actually.

Maybe I should try this new DiffAngleD and try again.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Angle difference - by bplus - 01-31-2023, 05:04 PM
RE: Angle difference - by MasterGy - 01-31-2023, 05:50 PM
RE: Angle difference - by OldMoses - 01-31-2023, 06:15 PM
RE: Angle difference - by bplus - 01-31-2023, 06:44 PM
RE: Angle difference - by OldMoses - 01-31-2023, 07:33 PM
RE: Angle difference - by bplus - 01-31-2023, 08:12 PM
RE: Angle difference - by OldMoses - 01-31-2023, 10:32 PM
RE: Angle difference - by SMcNeill - 01-31-2023, 09:29 PM
RE: Angle difference - by bplus - 01-31-2023, 10:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Angle Collisions james2464 91 15,645 11-04-2022, 12:56 AM
Last Post: OldMoses

Forum Jump:


Users browsing this thread: 1 Guest(s)