AI LOS and distance
by Judy L Tyrer · in Torque 3D Professional · 08/24/2009 (7:17 pm) · 7 replies
Goal: I want an AI to be able to tell what targets (players and other AI) are in the LOS within a given distance.
I started playing around with the container class to do this and started with the ray cast call as used in the carjack function. I used the angles used by that example and the AI failed to recognize the player when the player was standing almost directly in front of the AI at a very short distance. So are there instructions on how to set the raycast vectors somewhere?
I switched to the radius method and that worked, though I had to set the radius larger than I thought I should. The units are meters, correct?
What I really want is only those targets in front. While I can write this, I'd be surprised if someone else hasn't already done so and my problem is that I just didn't find it. Can someone point me in the right direction, please.
Thanks,
Judy
I started playing around with the container class to do this and started with the ray cast call as used in the carjack function. I used the angles used by that example and the AI failed to recognize the player when the player was standing almost directly in front of the AI at a very short distance. So are there instructions on how to set the raycast vectors somewhere?
I switched to the radius method and that worked, though I had to set the radius larger than I thought I should. The units are meters, correct?
What I really want is only those targets in front. While I can write this, I'd be surprised if someone else hasn't already done so and my problem is that I just didn't find it. Can someone point me in the right direction, please.
Thanks,
Judy
#2
08/27/2009 (8:25 pm)
Sadly, I cannot find Killer Kork. I see a lot of posts about using it, but the resource seems to have been removed. Any other suggestions?
#3
Killer Korc
08/27/2009 (8:41 pm)
Showed up as the first search result in the Resources for me... after searching for "Killer Korc", which is crazy because the resource is definitely spelled "Killer Kork" ;)Killer Korc
#5
It'll all be great in the end!
:)
08/27/2009 (8:50 pm)
Hey, resource section needs a bit of re-org ...It'll all be great in the end!
:)
#6
Wha wha what do you meeeeaann the eeennnd? *shivers* :)
08/27/2009 (11:29 pm)
"It'll all be great in the end!"Wha wha what do you meeeeaann the eeennnd? *shivers* :)
#7
This works only the first time, but the algorithm for storing the sensed data calls it for every player it senses and it fails to create them. Apparently script objects have become singletons. I looked into registering it as a console object, but to no avail. I had more success with creating the object as a SimObject.
But then the functions for AISensObj could not be found by referencing the %sensObj. For example:
This is the case with and without a datablock. And you can't just make up an object the code has never heard of as in "new AISensObj" as that won't compile.
So any clue how to create an non-singleton object that has functions associated with so that the functions can be found? Or is the only option building the class in C++?
08/30/2009 (12:52 pm)
Thanks all. I got killer kork, but alas, it doesn't seem to like creating more than one named object of the same type. The default code is:%sensObj = new ScriptObject(AISensObj) {};This works only the first time, but the algorithm for storing the sensed data calls it for every player it senses and it fails to create them. Apparently script objects have become singletons. I looked into registering it as a console object, but to no avail. I had more success with creating the object as a SimObject.
%sensObj = new SimObject()
{ classname = "AISensObj"; }But then the functions for AISensObj could not be found by referencing the %sensObj. For example:
function AISensObj::init(%this, %obj)
{ ... }
%sensObj.init()results in function could not be found.This is the case with and without a datablock. And you can't just make up an object the code has never heard of as in "new AISensObj" as that won't compile.
So any clue how to create an non-singleton object that has functions associated with so that the functions can be found? Or is the only option building the class in C++?
Associate Steve Acaster
[YorkshireRifles.com]