3rd person camera

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
psYco
Posts: 782
Joined: Wed Mar 15, 2006 10:55 am
Location: England

3rd person camera

Post 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])
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

i remeber a script on a site, think its hikes or fredricos script on thief3 look
Herp derp.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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. :)
Pain is only psychological.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
psYco
Posts: 782
Joined: Wed Mar 15, 2006 10:55 am
Location: England

Post 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
Post Reply