AI and Aiming
by Jeff Trier · in Torque Game Engine · 05/08/2004 (8:50 pm) · 9 replies
Hi All,
I am messing around with the bots, and I am having some trouble with their aiming at their target objects feet.
I have tried a few methods to correct this. Mainly revolving around setAimObject and setAimLocation.
When I use "%bot.setAimlocation(%obj.getEyetransform())", it works wonders in the vertical department, but it's a horizontal nightmare. I mean it aims at the correct horizontal location... eventually.
If I replace that command with "%bot.setAimObject(%obj)", it is just the oposite. It has horizontal accuracy, but fires at the targets feet.
My current idea is to try and set the bots aim a little higher, just after it calls the setAimObject function. However, I am not sure how to do that efficiently.
Does anyone have a solution to this problem? It seemed to be a pretty common problem after sifting the boards.
EDIT: GRAMMER
Thanks guys!
-Jeff
I am messing around with the bots, and I am having some trouble with their aiming at their target objects feet.
I have tried a few methods to correct this. Mainly revolving around setAimObject and setAimLocation.
When I use "%bot.setAimlocation(%obj.getEyetransform())", it works wonders in the vertical department, but it's a horizontal nightmare. I mean it aims at the correct horizontal location... eventually.
If I replace that command with "%bot.setAimObject(%obj)", it is just the oposite. It has horizontal accuracy, but fires at the targets feet.
My current idea is to try and set the bots aim a little higher, just after it calls the setAimObject function. However, I am not sure how to do that efficiently.
Does anyone have a solution to this problem? It seemed to be a pretty common problem after sifting the boards.
EDIT: GRAMMER
Thanks guys!
-Jeff
About the author
Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.
#2
Can this be done efficiently in script?
Thanks,
-Jeff
05/08/2004 (10:51 pm)
I was hoping not to have to intrude on the core code. But if there are no viable script based solutions, I guess I am going to have to.Can this be done efficiently in script?
Thanks,
-Jeff
#3
This will obtain the xyz transform and add 4 to the z.
05/09/2004 (4:26 am)
Yes, this can be done in script. Something like this (after you have the objects position,%pos = %obj.getTransform();This is just the objects X Y Z.
%pos = getWord(%pos,0) SPC getWord(%pos,1) SPC getWord(%pos,2) +4;
This will obtain the xyz transform and add 4 to the z.
#4
The problem with that method is I can either:
1) Lift the bot or target to the required height.
2) Have the projectile fire that much higher from the muzzle.
3) Rotate the bots whole body to manage the projectile arc.
Unless I missed a possibility, they all equal "eeww". :)
I have a feeling that I may have to mess with the engine code. Sigh... I guess my biggest apprehension with that is my newbieness and more importantly, my wanting to stay compatible with the changes made by GG. I guess that isn't too realistic since a new version of the engine may be incompatible with my script code.
05/09/2004 (7:39 am)
Thanks Westy,The problem with that method is I can either:
1) Lift the bot or target to the required height.
2) Have the projectile fire that much higher from the muzzle.
3) Rotate the bots whole body to manage the projectile arc.
Unless I missed a possibility, they all equal "eeww". :)
I have a feeling that I may have to mess with the engine code. Sigh... I guess my biggest apprehension with that is my newbieness and more importantly, my wanting to stay compatible with the changes made by GG. I guess that isn't too realistic since a new version of the engine may be incompatible with my script code.
#5
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1714
05/09/2004 (8:03 am)
All that does it chnage where the bot is aiming (higher), no need to move anything. what would be better is using that and tying in the projectile spread code for the bot.www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1714
#7
The change to make the AI aim higher should be very few lines. As you probably know, CVS merges changes whenever possible, so unless we touch the exact same lines of source, your changes will remain.
Sometimes it's better to do a little C++ tweaking than to do a load of script. :)
05/09/2004 (5:20 pm)
Jeff,The change to make the AI aim higher should be very few lines. As you probably know, CVS merges changes whenever possible, so unless we touch the exact same lines of source, your changes will remain.
Sometimes it's better to do a little C++ tweaking than to do a load of script. :)
#9
Decided to go with setAimLocation. I did a few tests with it and I think it will work after all. :)
Thanks again!
-Jeff
05/10/2004 (6:08 pm)
Thanks guys. Decided to go with setAimLocation. I did a few tests with it and I think it will work after all. :)
Thanks again!
-Jeff
Associate Kyle Carter