hey for
self.camera_pitch
what is it stored in? radians?
camera pitch
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
camera pitch
Herp derp.
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Re: camera pitch
ok i made the script so that the gun stays on screen but
is just ridiculous. any way to shorten or better idea?
Code: Select all
pos[ ()
{
camerapitchtemp = self.camera_pitch;
if(self.camera_pitch > 0.4)
{
PositionToPawn("player",offsetX,offsetY+4,offsetZ+4,true,false);
}
else
{
if(self.camera_pitch > 0.3)
{
PositionToPawn("player",offsetX,offsetY+3,offsetZ+3,true,false);
}
else
{
if(self.camera_pitch > 0.2)
{
PositionToPawn("player",offsetX,offsetY+2,offsetZ+2,true,false);
}
else
{
if(self.camera_pitch > 0.1)
{
PositionToPawn("player",offsetX,offsetY+1,offsetZ+1,true,false);
}
else
{
PositionToPawn("player",offsetX,offsetY,offsetZ,true,false);
}
}
}
}
self.ideal_yaw = self.player_yaw;
ChangeYaw();
self.ideal_pitch = self.camera_pitch;
ChangePitch();
} ]Herp derp.
Re: camera pitch
Basic mathematics:
You may need to add or remove some minuses to get it right, though ('-self.camera_pitch' -> 'self.camera_pitch' and vice versa).
Code: Select all
PositionToPawn("player",offsetX,offsetY*cos(-self.camera_pitch)+offsetZ*sin(-self.camera_pitch),offsetZ*cos(self.camera_pitch)+offsetY*sin(self.camera_pitch),true,false);Pain is only psychological.
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Re: camera pitch
tried all teh combos, doesnt seem to work, it just makes my arms fly forward
Herp derp.
Re: camera pitch
Oh, I just realized it needs a little addition:
OFFSETY is the height of the camera from the player's origin. The camera height is defined in the camera.ini. So for example if camera.ini says: 'height = 50', you would set 'OFFSETY = 50'.
offsetY is the weapon's Y-offset from the camera.
Code: Select all
PositionToPawn("player",offsetX,OFFSETY+offsetY*cos(-self.camera_pitch)+offsetZ*sin(-self.camera_pitch),offsetZ*cos(self.camera_pitch)+offsetY*sin(self.camera_pitch),true,false);
offsetY is the weapon's Y-offset from the camera.
Pain is only psychological.
- darksmaster923
- Posts: 1857
- Joined: Wed Jan 03, 2007 10:32 pm
- Location: Huntington Beach, California, USA
Re: camera pitch
didnt actually get it to work so i made this
gud enough for my needs
Code: Select all
camerapitchtemp = self.camera_pitch*10;
PositionToPawn("player",offsetX,75+offsetY+camerapitchtemp,offsetZ+camerapitchtemp,true,false);Herp derp.