camera pitch

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

camera pitch

Post by darksmaster923 »

hey for
self.camera_pitch
what is it stored in? radians?
Herp derp.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: camera pitch

Post by darksmaster923 »

ok i made the script so that the gun stays on screen but

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();
	} ]
is just ridiculous. any way to shorten or better idea?
Herp derp.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: camera pitch

Post by Juutis »

Basic mathematics:

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);
You may need to add or remove some minuses to get it right, though ('-self.camera_pitch' -> 'self.camera_pitch' and vice versa).
Pain is only psychological.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: camera pitch

Post by darksmaster923 »

tried all teh combos, doesnt seem to work, it just makes my arms fly forward
Herp derp.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: camera pitch

Post by Juutis »

Oh, I just realized it needs a little addition:

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 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.
Pain is only psychological.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: camera pitch

Post by darksmaster923 »

didnt actually get it to work so i made this

Code: Select all

camerapitchtemp = self.camera_pitch*10;
PositionToPawn("player",offsetX,75+offsetY+camerapitchtemp,offsetZ+camerapitchtemp,true,false);
gud enough for my needs
Herp derp.
Post Reply