mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-22 05:55:42 +00:00
Fixed thirdperson
This commit is contained in:
parent
fe4e761c64
commit
dcbee17c25
@ -2413,6 +2413,38 @@ botMoveTo(where)
|
|||||||
self.bot.moveTo = where;
|
self.bot.moveTo = where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gets the camera offset for thirdperson
|
||||||
|
*/
|
||||||
|
botGetThirdPersonOffset(angles)
|
||||||
|
{
|
||||||
|
offset = (0,0,0);
|
||||||
|
|
||||||
|
if (getDvarInt("camera_thirdPerson"))
|
||||||
|
{
|
||||||
|
offset = getDvarVector("camera_thirdPersonOffset");
|
||||||
|
if (self playerAds() >= 1)
|
||||||
|
{
|
||||||
|
curweap = self getCurrentWeapon();
|
||||||
|
if ((isSubStr(curweap, "thermal_") || weaponClass(curweap) == "sniper") && !isSubStr(curweap, "acog_"))
|
||||||
|
offset = (0,0,0);
|
||||||
|
else
|
||||||
|
offset = getDvarVector("camera_thirdPersonOffsetAds");
|
||||||
|
}
|
||||||
|
|
||||||
|
// rotate about x // y cos xangle - z sin xangle // y sin xangle + z cos xangle
|
||||||
|
offset = (offset[0], offset[1] * cos(angles[2]) - offset[2] * sin(angles[2]), offset[1] * sin(angles[2]) + offset[2] * cos(angles[2]));
|
||||||
|
|
||||||
|
// rotate about y
|
||||||
|
offset = (offset[0] * cos(angles[0]) + offset[2] * sin(angles[0]), offset[1], (0-offset[0]) * sin(angles[0]) + offset[2] * cos(angles[0]));
|
||||||
|
|
||||||
|
// rotate about z
|
||||||
|
offset = (offset[0] * cos(angles[1]) - offset[1] * sin(angles[1]), offset[0] * sin(angles[1]) + offset[1] * cos(angles[1]), offset[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bots will look at the pos
|
Bots will look at the pos
|
||||||
*/
|
*/
|
||||||
@ -2441,12 +2473,14 @@ bot_lookat(pos, time, vel)
|
|||||||
if (steps < 1)
|
if (steps < 1)
|
||||||
steps = 1;
|
steps = 1;
|
||||||
|
|
||||||
|
myAngle=self getPlayerAngles();
|
||||||
|
|
||||||
myEye = self GetEye(); // get our eye pos
|
myEye = self GetEye(); // get our eye pos
|
||||||
|
myEye += self botGetThirdPersonOffset(myAngle); // account for third person
|
||||||
myEye += (self getVelocity() * 0.05) * (steps - 1); // account for our velocity
|
myEye += (self getVelocity() * 0.05) * (steps - 1); // account for our velocity
|
||||||
|
|
||||||
pos += (vel * 0.05) * (steps - 1); // add the velocity vector
|
pos += (vel * 0.05) * (steps - 1); // add the velocity vector
|
||||||
|
|
||||||
myAngle=self getPlayerAngles();
|
|
||||||
angles = VectorToAngles( (pos - myEye) - anglesToForward(myAngle) );
|
angles = VectorToAngles( (pos - myEye) - anglesToForward(myAngle) );
|
||||||
|
|
||||||
X=(angles[0]-myAngle[0]);
|
X=(angles[0]-myAngle[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user