### aiPlayer aim

Scripting questions, discussions, etc
• 1
• 2

#### Re: aiPlayer aim

Steve_Yorkshire
Posts: 296
Joined: Tue Feb 03, 2015 10:30 pm

@ Hodo33 Got a fix for you.
The reason this is happening is that the further the distance from the target, the smaller the aim rotation change and the default code setting ignores anything under 0.01f. Aiming at a playerObject near his eyeNode and at the same position height makes the rotation change even smaller.

Check out these pics, no change in LOS at range (~70 units) between z offset 0 and +0.5, but definite aim change up close between +0.5 and +1.0.
https://imgur.com/a/Wfcj1Xh

Changing AIplayer.cpp ~line 478 in getAiMove to make default ignore rotation smaller. I added 2 more zeros as 1 didn't seem enough at >100m distance.
//..
// This should be adjusted to run from the
// eye point to the object's center position. Though this
// works well enough for now.
F32 vertDist = mAimLocation.z - location.z;
F32 horzDist = mSqrt(xDiff * xDiff + yDiff * yDiff);
F32 newPitch = mAtan2( horzDist, vertDist ) - ( M_PI_F / 2.0f );
if (mFabs(newPitch) > 0.0001f)//yorks was 0.01
{
}
//..

And this is the difference at 120 units.

@ Azaezel @ JeffR maybe one for rolling into development? (you know github hates me )

[EDIT]
Just to note, this is using the standard Lurker file only with projectile spread set to 0 and projectileData lifetime very much increased - just for testing, it doesn't use the eyeOffSet value which I suggested earlier in this thread (so you can ignore that).
datablock ShapeBaseImageData(LurkerWeaponImage)
{
// Basic Item properties
shapeFile = "art/shapes/weapons/Lurker/TP_Lurker.DAE";
shapeFileFP = "art/shapes/weapons/Lurker/FP_Lurker.DAE";
emap = true;

imageAnimPrefix = "Rifle";
imageAnimPrefixFP = "Rifle";

// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
firstPerson = true;
useEyeNode = true;
animateOnServer = true;

// When firing from a point offset from the eye, muzzle correction
// will adjust the muzzle vector to point to the eye LOS point.
// Since this weapon doesn't actually fire from the muzzle point,
// we need to turn this off.
correctMuzzleVector = true;
//... etc etc

This newPitch setting of 0.0001f, gives pitch offset increments of z +1.0 at 650 metres/units - which is way more than visual distance.

#### Re: aiPlayer aim

Hodo33
Posts: 47
Joined: Fri Dec 29, 2017 4:34 pm
Thanks for the info Steve. I will make some changes there and see what happens.

#### Re: aiPlayer aim

Hodo33
Posts: 47
Joined: Fri Dec 29, 2017 4:34 pm
I just noticed I hadn't responded to this. Steve got the magic fix and the bots are brutal now. Thanks for the help to all ....
• 1
• 2

#### Who is online

Users browsing this forum: No registered users and 2 guests