Ok, so I want to be able to poll distant objects and tell how far they are from the base point, and be able to act upon that.
I can better describe it as having a static object that polls for enemies, but can't tell when or where the enemies can come up. Once they appear, I can continuously poll for their positions and update the game accordingly.
But I don't know how to judge distance. One thing I can think of would be to determine threats within the 3D world, and send out a bullet of some kind to determine their distance away (like ecolocation), but would that take too long if I had to continuously do it every frame?
I don'tk now, tell me what you think,
Thanks,
Jason
3D interception/distance gauging
Started by gardon, Mar 19 2006 01:59 AM
5 replies to this topic
#1
Posted 19 March 2006 - 01:59 AM
#2
Posted 19 March 2006 - 04:39 AM
Umm...
sqrt(x^2 + y^2 + z^2)?
sqrt(x^2 + y^2 + z^2)?
reedbeta.com - developer blog, OpenGL demos, and other projects
#3
Posted 19 March 2006 - 04:51 AM
but if you don't know what the point is.
Say I'm scanning in coordinates, as in the item is randomly generated but I don't want to manually use the coordinates of that object, but scan them in (find out what the point is).
How do I find out what the point of an object is without knowing it?
Jason
Say I'm scanning in coordinates, as in the item is randomly generated but I don't want to manually use the coordinates of that object, but scan them in (find out what the point is).
How do I find out what the point of an object is without knowing it?
Jason
#4
Posted 19 March 2006 - 06:42 AM
So you're talking about simulating one game entity 'looking' for another?
You'll have to decide what capabilities your 'looking' entity has. Can it look in different directions, and see an enemy if it is within a field of view? Does it have to poll squares of a grid, and can tell whether an enemy is on a given grid square? The strategies for either case are pretty much what you would expect. I'm assuming that your entity can only search a limited amount of space each frame, so as to give a delay in detecting new enemies - otherwise it would make no sense not to simply query the enemy's location.
You'll have to decide what capabilities your 'looking' entity has. Can it look in different directions, and see an enemy if it is within a field of view? Does it have to poll squares of a grid, and can tell whether an enemy is on a given grid square? The strategies for either case are pretty much what you would expect. I'm assuming that your entity can only search a limited amount of space each frame, so as to give a delay in detecting new enemies - otherwise it would make no sense not to simply query the enemy's location.
reedbeta.com - developer blog, OpenGL demos, and other projects
#5
Posted 19 March 2006 - 05:08 PM
The only way I can really describe it is:
Imagine you're some object, and you have a sensor every 60 degrees along your arc (so 6 sensors with 60 degree field of views), and those sensors scan their field for enemies. But, the only way I can tell where an enemy is, is by looking through the scanner.
the only problem is that I don't know who to judge how far the object is, without a basic relative size (because I don't know what the size will be)
Jason
Imagine you're some object, and you have a sensor every 60 degrees along your arc (so 6 sensors with 60 degree field of views), and those sensors scan their field for enemies. But, the only way I can tell where an enemy is, is by looking through the scanner.
the only problem is that I don't know who to judge how far the object is, without a basic relative size (because I don't know what the size will be)
Jason
#6
Posted 19 March 2006 - 06:03 PM
Okay, so when you're 'looking through the scanner', it's as if you had a 2D image rendered from that scanner's point of view? You can see the enemy in the image, but you can't tell how far away the enemy is because you don't know how tall he is?
The only solution to this would be to get two or more scanners both looking in the same direction. Then, if you know the distance between the scanners, you can use parallax (how much the enemy moves horizontally in the two images) to calculate how far away it is. This is one of the same methods that human brains use (ever wondered why we have two eyes on the front of our face?)
I have to say though that this seems like a lot of unnecessary trouble to go to. Maybe I don't understand what you want to use this for very well, but it would be much easier to 'assume' that your scanner knows how to tell how far away an enemy is and just use the distance formula (maybe with some random noise to simulate inaccuracy).
The only solution to this would be to get two or more scanners both looking in the same direction. Then, if you know the distance between the scanners, you can use parallax (how much the enemy moves horizontally in the two images) to calculate how far away it is. This is one of the same methods that human brains use (ever wondered why we have two eyes on the front of our face?)
I have to say though that this seems like a lot of unnecessary trouble to go to. Maybe I don't understand what you want to use this for very well, but it would be much easier to 'assume' that your scanner knows how to tell how far away an enemy is and just use the distance formula (maybe with some random noise to simulate inaccuracy).
reedbeta.com - developer blog, OpenGL demos, and other projects
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












