PDA

View Full Version : Valve Thridperson Tutorial


Beky
06-11-2007, 02:23 PM
I implemented the posted Valve Thirdperson camera tutorial rebuilt my code and had no errors. However when I run my mod and hit my assigned button I get a console error unknown command +camchange. Using sv_cheats 1 saving and reloading will give me third person camera but I have to do the steps twice before it will work and I get the player.mdl!

blacksmith123
06-11-2007, 03:12 PM
Wouldn't the command be just "thirdperson"? Or are you going for a toggle?

Beky
06-11-2007, 03:45 PM
I was following the tutorial which happens to be toggled. :)

Beky
06-12-2007, 12:15 PM
I mean my keyboard variable is set (obviously) and concommand has been declared and associated to the declared function. Calcbits is there what could I have possibly missed?

D. evil
06-18-2007, 07:09 PM
Hi there,

I have third person working fully (with very LITTLE thanks to the outdated tutorial on the value developer wiki, but it helped a little). Bascially the model needs to be updated in a leaf structure once it has been loaded in. You'll probably find if you turn on the flash light (use impulse 101 in the console to get weapons and flash light) that the model will load.

This happens because the flash light is actually similar to loading an entity (the light effect that comes with turning it on) and when you do that the leaf structure is updated and any model that hasn't been loaded in, is then loaded.

So, to solve the problem you need to call a function called UpdateVisibility() in your in_camera.cpp file. At least that worked for me. I'll write a fully working tutorial on third person camera (including 3rd person animation etc) as soon as I get a little more time, I've been promising for ages already! haha... but hope this helps a bit.

lodle
06-18-2007, 07:28 PM
Sounds good D evil. How bout if you have some free time to update the tutorial on the wiki so every one can benefit from this please.

Angry_Bacon
07-02-2007, 05:07 PM
Putting UpdateVisibility() into in_camera.cpp doesn't work (for me at least) because its in the baseentity code, not the input code. Trying to compile with that in in_camera gives me this.**PATH**\in_camera.cpp(570) : error C3861: 'UpdateVisibility': identifier not found

I already have UpdateVisibility() in my c_baseplayer.cpp, and the model will load when I do the flashlight thing. Also, I am not getting any animations for pistols, grav gun, crowbar, and a few other things.

--Update!--

pPlayer->UpdateVisibility() seems to work!

Also, any idea how I would make the camera not go as low while crouching?

--Update again---

Lack of animations are because the model I'm using apparently doesn't have them. I still need to figure out how to get the camera to not go as low while crouching though.

Lolmen
07-11-2007, 12:06 PM
I'm implemented all like in this TPcamera tutorial and hey, does it normal when I'm looking to down player model go down too?
http://img231.imageshack.us/img231/8518/suckedsbugsbl7.jpg (http://imageshack.us)

How I can fastly solve that?

Also some warnings in console distrub me as well :

mod_studio: MOVETYPE_FOLLOW with no model.
mod_studio: MOVETYPE_FOLLOW with no model.
mod_studio: MOVETYPE_FOLLOW with no model.
mod_studio: MOVETYPE_FOLLOW with no model

WTF?

Lolmen
07-12-2007, 03:32 PM
I wish to leave this mess behind.
Any ideas will be appreciate.

Beky
07-13-2007, 08:17 AM
no cheats required

move the CAM_ToThirdPerson(); under QAngle and comment out the toggle code and you have a really crappy side view of a model; oh don't forget to add the animations bit to hl2player as stated in the tut. You can't copy and paste the original code from player.cpp(something like that) it won't work but the tut code works fine. Replace player.mdl with a model of your choice and then tweak your view angles and camera AI.


void CInput::CAM_Think( void )
{
Vector origin;
Vector ext, pnt, camForward, camRight, camUp;
float dist;
Vector camAngles;
float flSensitivity;
QAngle viewangles;
CAM_ToThirdPerson();

/*
switch( cam_command.GetInt() )
{
case CAM_COMMAND_TOTHIRDPERSON:
CAM_ToThirdPerson();
break;

case CAM_COMMAND_TOFIRSTPERSON:
CAM_ToFirstPerson();
break;

case CAM_COMMAND_NONE:
default:
break;
}

if( !m_fCameraInThirdPerson )
return;

if ( !sv_cheats )
{
sv_cheats = cvar->FindVar( "sv_cheats" );
}

// If cheats have been disabled, pull us back out of third-person view.
if ( sv_cheats && !sv_cheats->GetBool() )
{
CAM_ToFirstPerson();
return;
}
*/


oh and when I say replace player.mdl I mean find in whole solution and replace with don't forget to add the proper directories. ;)

Lolmen
07-13-2007, 10:26 AM
Yeah, I already implemented it. The screenshot prove that, but the problem is that player model don't carrying weapons on it self hands I mean world model of that weapon, also player model change relative angles with camera by [pitch] axis, and this cause looks like model dives into the ground. I think it occurs because the model should rotate it self by "pitch poseparameter" but it doesn't , so model rotation goes from origin of legs. Take look at screen upward.

Is these some varios problem and still don't have solution?
And do you have same bug?

Beky
07-13-2007, 11:52 AM
I have some weapons problems but I'm using an old model of mine and the skeleton wasn't set up right. As for the orientation I have no problems what so ever.

Lolmen
07-13-2007, 12:43 PM
Damn, eh, did you do it under HL2SP?

Beky
07-13-2007, 01:13 PM
Yeah hl2 single player..........................

Lolmen
07-13-2007, 05:51 PM
Wow, it make me crazy, so I should do some investigation out here:
Did you try to use default NPC models (models/barney.mdl) as player models?
Did you do something else than simply implementing all like in tutorial?
How you sets player model in game?
How you fix muzzle flash bug?
Can you show me some screens on which player looking onto the ground?

Beky
07-13-2007, 07:29 PM
Hey I never said I fixed the muzzle flash problem. I'm making a third person adventure I don't even use guns 'xcept a half dead phaser. All I'm saying is if you do it the way I wrote above you don't have to implement sv_cheats impulse 101 flashlight or anything else. Also my character stays oriented the proper way. I'm using my own model and I'm sorry but I have no way to post screens nor am I at the moment willing to it's my final project for school and its presently under dev. My way is a lot shorter too, all though it's not toggle capable, but I don't need to toggle between first and third. Did you custom Rig I assumed the muzzle flash was caused by an orientation problem with my bones for attachments. My first model was a little bit screwed in terms of hierarchy, I used all the twists that was used on Alyx they weren't however placed correctly and I had some issues switching between max and may; I'm using XSI now. :)

goddzillajk
07-14-2007, 04:43 AM
hmm i had the same problem with the player-models pitch:
-the thread- (http://forums.steampowered.com/forums/showthread.php?t=562840)