View Full Version : Projectile AI (Target Visibility + Status)

20th Sep 2001, 07:18 AM
I've started working on the "AI" of a new type of seeking rocket I've been making and have run into a few minor problems.

1: What do HitLocation and HitNormal mean when it comes to a trace function? My goal is pretty simply but I can't seem to figure it out. All I want to do is trace from point A (location of missile) to point B (location of target) and return what it hits. Basically I want to know if the rocket can see the target or not.


2: What is the proper way to save a location to a variable? I have a vector variable I've named SeekingLast so to me it would make sense that SeekingLast = Seeking.Location would save the location of Seeking into the SeekingLast variable for later use. This does not work (for what is most likely an obvious reason to all of you). What am I missing? I have a feeling it has something to do with the magnitude (or lack of) of the SeekingLast vector but I really have no idea why this won't work or how to properly save the coordinates of a location for later use.

3: Is there an easy way to say that PawnVariable = ActorVariable? Even though the Seeking variable is a pawn, it is declared as an actor by the rocket launcher. That prevents me from typing seeking.health (to make sure the target is still alive). I tried doing something like PawnVariable = SeekingActor but that returns an error. Is there any way I can check the health of an actor or set a pawn variable to that of the actor variable?

Once I figure those things out I can make my rockets a tad smarter so that when their target dies they find a new one and when they lose sight of their target they go to it's last known position and continue looking. Thanks in advance.

26th Sep 2001, 06:12 PM
1: Hitlocation and HitNormal are what the trace actually hits. HitLocation is the location of wherever the trace hits, and hitnormal is the ... outward pointing vector of whatever it hits. The problem with doing the seeking like that is that if theres something like a pawn or a decoration between the missile and its target then the missile will think that it cant see its target anymore since the trace ended on someone else.
2: I dont see why it doesnt work, i mean, yeah... it should work just fine. Its not a local variable is it? because those arent really saved... theyre taken away after the function is over
3: yeah, theres an easy way. just put PawnVariable=Pawn(Actorvariable). Only problem with that is if Actorvariable isnt a pawn then PawnVariable will be None. But i dont think that youll encounter that problem as long as youre keeping the seeking object to pawns.
uh... i dont know if that answers anything, or if youve even been sticking around to check if someones answered. But yeah, eat your dog

27th Sep 2001, 09:23 AM
Thanks. Somebody else clued me in on this stuff a little while after I posted this but your reply confirms their answers so I know I'm doing it right now.

It turns out that I was in fact recording the location correctly. The problem was with the trace. I'm now using FastTrace which simply lets me see if it completes a line from the missile to the target. Before the trace wasn't working right so it was returning null (and thus never even attempting to save the location so the missiles would always seek null, 0,0,0 on the map).