Hey guys,
I'm making a AI coding game that has tanks you can program to fight each other. I know it's been done before, but I don't care. Anyway, I need to make a radar system for my tanks. The arena that the tanks battle in is completely flat and there or only two types of objects that the radar can see, other tanks, and obsticles. Both the obsticles and the tanks are going to be entitys in the game world. I need to make a radar system that will let the user set the range of the radar, the scan arc in degrees. This is only a 2D detection, does need to detect up and down.
So what I'm thinking is I need to first determine if there are anything in range of the rader, if not leave the funtion. If the first check passes, I need a way to figure out if the object it sees is in the radar scan arc. This arc would be something like 90 degrees wide in front of the tank. This is where I'm kind of lost. I'm not sure how to get the angle of the object relative to the tank. I'm guessing it's some kind of point tranform trick. Anybody got any ideas? I'm sure this is pretty easy, I'm just a dumb ass with math.
I'm making a AI coding game that has tanks you can program to fight each other. I know it's been done before, but I don't care. Anyway, I need to make a radar system for my tanks. The arena that the tanks battle in is completely flat and there or only two types of objects that the radar can see, other tanks, and obsticles. Both the obsticles and the tanks are going to be entitys in the game world. I need to make a radar system that will let the user set the range of the radar, the scan arc in degrees. This is only a 2D detection, does need to detect up and down.
So what I'm thinking is I need to first determine if there are anything in range of the rader, if not leave the funtion. If the first check passes, I need a way to figure out if the object it sees is in the radar scan arc. This arc would be something like 90 degrees wide in front of the tank. This is where I'm kind of lost. I'm not sure how to get the angle of the object relative to the tank. I'm guessing it's some kind of point tranform trick. Anybody got any ideas? I'm sure this is pretty easy, I'm just a dumb ass with math.