by Sajt » Thu Jan 13, 2011 12:05 am
Read it over again, he doesn't want a chasecam. He's said that several times. He wants a camera that sits in one spot.
It's been a while for me but it has something to do with SVC_SETVIEW. (This isn't defined in defs.qc, you have to add it. I think it might be 5 or something.) SETVIEW makes the view occur from the position of a different entity (rather than the player entity). Make sure the entity that you set it to has a model (even null.spr or something like that) or it won't get sent over the network and your view will be from the world origin. (This drove me crazy when I was first trying to do this sort of thing.)
Then you use SVC_SETANGLE (or something like that. it's also not defined in defs.qc) to change the camera angles. The angles are compressed badly so if you want the camera to smoothly turn (e.g. look at the player), you're probably out of luck. It will turn pretty jerkily. But if you just have a totally static camera you won't notice it. Anyway, if you don't call SVC_SETANGLE at all, I think what happens is the player can still turn the view with the mouse. So you should set to zero (in autoexec.cfg) all the clientside cvars associated with turning: cl_turnspeed, cl_lookspeed, m_pitch, m_yaw (I think those are what they're called, anyway), then do SVC_SETANGLE.
SVC_SETVIEW and SVC_SETANGLE are used with the MSG_WriteByte etc. functions. You should send them with MSG_ONE. I don't remember the exact arguments, but it's probably something like this:
msg_entity = player; // the player (client) to send this message to
MSG_WriteByte(MSG_ONE, SVC_SETVIEW);
MSG_WriteEntity(MSG_ONE, camera_entity);
MSG_WriteByte(MSG_ONE, SVC_SETANGLE);
MSG_WriteAngle(MSG_ONE, angle_x);
MSG_WriteAngle(MSG_ONE, angle_y);
MSG_WriteAngle(MSG_ONE, angle_z);
(Again, this is off the top of my head. I haven't done anything like this in about eight years.)
You should only have to do this once per camera change, not every frame, unless you want the camera to turn towards the player.
Sorry, Nahuel, this probably won't help you directly. Hopefully somebody can come in who knows about this stuff. I'm sure Spike does.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.