Jump to content
Sign in to follow this  
Heavensrevenger

Need help to find the intented Target of AI

Recommended Posts

Hey I want to make the C-RAM bullets explode if they fly past the target. I know how I'll do the Code but I don't know how to get the object that the C-RAM is currently shooting at. Any help is appreciated!

Share this post


Link to post
Share on other sites
On 12/28/2023 at 4:54 PM, Heavensrevenger said:

Hey I want to make the C-RAM bullets explode if they fly past the target. I know how I'll do the Code but I don't know how to get the object that the C-RAM is currently shooting at. Any help is appreciated!

 

Best bet AFAIK is probably looking at targets and aimedAtTarget.

 

Methodology:

1. Filter targets result for known and up to date objects

2. If only one is found you're set, otherwise continue.

3. Loop over the filtered result and check with aimedAtTarget if any return 1 and pick that as your target

 

If in step 3 aimedAtTarget always equals 0 you can instead use the dot product between shooter's weaponDirection and vectorNormalized ( _targetPosASL vectorDiff _shooterPosASL ). The dot product will give you a value -1 to 1 of how aligned two vectors are, or in your case how "on target" you are, pick the target with the largest dot product and you should be good.

 

 

Share this post


Link to post
Share on other sites

Ah nice, thank you that should do. I assume the praetorians aim will always be close to 1 for the intended target.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×