Page 1 of 1

3rd person camera

Posted: Sat Mar 24, 2007 10:19 am
by psYco
Is it possible to make the 3rd person camera be able to rotate etc freely without rotating the player actor? (so you could look all around you and the camera would be fixed to your player but the player model itself would remain stationary:

here is my camera script

Code: Select all


{
OFFSETY		[75]

	Spawn[ ()
	{
		Console(true);
		Gravity(false);
		SetNoCollision();
		HideFromRadar(true);
		BoxWidth(0);
		BoxHeight(0);

		LowLevel("Setup");
	} ]

	Setup[ ()
	{
		self.ThinkTime = 0;

		self.yaw_speed = 10000;
		self.pitch_speed = 10000;
		AttachCamera();
		PawnRender(false);

		self.think = "idle";
	} ]

	idle[ ()
	{
		self.ThinkTime = 0;

		if(GetEventState("crouch"))
		{
			if(OFFSETY > 40)
			{
				OFFSETY = OFFSETY - 5;
			}
			else
			{
				OFFSETY = 40;
			}
		}
		else
		{
			if(OFFSETY < 75)
			{
				OFFSETY = OFFSETY + 5;
			}
			else
			{
				OFFSETY = 75;
			}
		}

		PositionToPawn("player",0,OFFSETY,0,true,false);

		self.ideal_yaw = self.player_yaw + 3.141592654;
		ChangeYaw();

	} ]

}


its in the scripts folder and then there is a pawn in the level that uses the script, ive looked at the commands list and nothing seems to be directly related to this, so I was wondering if anyone could think of a work around to get the desired affect,

(oh and the player is completely stationary so it wont be able to walk around so Isometric view is out of the question)

Anyhelp would really be appreciated :D

(oh and just so you know im using Juutises camera script from the nirhis game [and I asked permission in advance])

Posted: Sat Mar 24, 2007 5:35 pm
by darksmaster923
i remeber a script on a site, think its hikes or fredricos script on thief3 look

Posted: Sun Mar 25, 2007 1:42 pm
by Juutis
With a scripted player and a seperate pawn for the camera, it's pretty easy to do. And that's exactly what you have there, right?

Always when you move the mouse the built-in player rotates along with it, no matter if there is a scripted player. The rotation of the scripted player (in my scripts, at least) is based on that fact. When the built-in player rotates, the pawns (the camera and the actual main character) rotate too. In this script it is done with lines:

Code: Select all

      self.ideal_yaw = self.player_yaw + 3.141592654;
      ChangeYaw();
Now, if you disabled the rotation of the scripted player (when pressing a key, for example) the camera pawn would still rotate. And I guess that does it. :)

Posted: Sun Mar 25, 2007 4:37 pm
by Jay
You could make a FixedCamera, set the LevelView to FixedCamera and then move around this camera with a script. This way you have full cotrol over the camera.

Posted: Sun Mar 25, 2007 6:01 pm
by psYco
Thanks very much everybody for the feedback and ideas, :D

Im going to use Juutis's method since its directly related to my scripts and sounds really simple to do :D Im really glad im using a scripted player now :)

Thanks for the help. I am now THAT much closer to a finished demo :P