Hi,
is it any method to get the origin of the camera view? I know the "tag_eye", but it works aright only in first person, but I use thirdperson in my mod. So can I solve somehow that the players shoot the center of the view?
Hi,
is it any method to get the origin of the camera view? I know the "tag_eye", but it works aright only in first person, but I use thirdperson in my mod. So can I solve somehow that the players shoot the center of the view?
Hey, i've a good function for that, but the problem is, that it needs getStance(), which is no default function (you need to find it somewhere or maybe somebody will post here some hints).
Maybe player getEye() is also already good enough?PHP Code:
getRealEye()
{
player = self;
stance = player std\player::getStance();
offset = 0;
switch (stance)
{
case "stand": offset = 20; break;
case "duck": offset = 0; break;
case "lie": offset = -30; break;
//default: offset = getcvarint("offset");
}
realEye = player getEye() + (0,0,offset);
return realEye;
}
timescale 0.01
If i remember correctly, the 3rd person used a few client-cvars to determine camera offsets. Maybe those will provide you with the insight you need?
They should all start with cg_thirdperson.
I'd like to make only a 3rd person mod but i don't know how to solve the exact shooting.
Thought some time over it, but the only solution seems to be engine hacking.
PHP Code:
onShoot {
manipulate bullet origin for left/right leaning
}
timescale 0.01
I thought I cannot solve this
The camera position in thirdperson is defined by a vector from the player's head, which length is the client cvar cg_thirdPersonRange, and direction can be counted by the player's up angle of view - the stock function getPlayerAngles()[0]. So,
1) get the eye position;
2) knowing that cg_thirdpersonrange is cheat-protected and thus can't be changed by client unless hacked/devmap, you will want to use its default value, 120;
3) convert player angles to vector;
4) multiply 2) by 3) and you have it.
The only problem here is, there is NO CLIPPING! The camera position calculated by this algorithm may get into solid objects, whereas actual camera has collision check. Well, you can simply BulletTrace() it then.
Last edited by megazor; 6th July 2013 at 05:29.
Yea, that camera-position could be calculated, but he needs to modificate the origin of thirdperson-bullets
timescale 0.01
Take a look at the cod4mod firing through walls code for ideas on that