Inside3D!
     

changing view point?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
RooT



Joined: 07 Sep 2005
Posts: 40

PostPosted: Tue Sep 13, 2005 4:55 am    Post subject: changing view point? Reply with quote

what im trying to do is have an entity in the map "info_camera" direct the view of all clients. the camera is stationary, and everyone sees the arena from this position. the main problem im having is setting the players view position.

________________
| o |
| |
| / o |
| . [
| \ |
| o |
|_______________|

. = camera spot
o = clients
[ = door
/ and \ are the angle that the camera can see, it doesnt move.


so what from what i understand i need to spawn a camera entity for each client (because i want different rooms to activate this same type of camera in their own room, while some clients may be in others) i used a chase cam and tried to edit it to simply move to a spot on the map but it didnt work right. so im at the point of just trying to code an origin into the file, making it imposible to map for and thus not very useful. if you have any ideas let me know, prefferably by private message so i can write back easier. thanks
-Root one
_________________
My mod site!
Mod Status:
Turret Defense: 30%
UPS: 45%
Back to top
View user's profile Send private message AIM Address
Error
Inside3D Staff


Joined: 05 Nov 2004
Posts: 558
Location: VA, USA

PostPosted: Tue Sep 13, 2005 5:19 am    Post subject: Reply with quote

RooT: you should definately come to the IRC chatroom on the irc.anynet.org server. in #qc
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Sep 13, 2005 6:55 am    Post subject: Reply with quote

Sounds like you want something like alone in the dark.
Where there's one camera in each room (or two, for those hard to reach areas...).

Are these cameras ever going to actually move?
If not, you can just position a camera entity, and use the svc_setview protocol, which is designed to set a player's view entity. So you send it to the moving player, send the camera entity, and the player will see from the camera entity rather than thier own. A handy trick. To undo it, just set the view back to the player.
Back to top
View user's profile Send private message Visit poster's website
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Tue Sep 13, 2005 8:37 am    Post subject: Reply with quote

The biggest thing to know is: the camera entity NEEDS a model (set with setmodel), because otherwise the entity is not sent to the clients, so when you use SVC_SETVIEW it will be pointing to a nonexistant entity.

Get a null model (model of 1 tiny polygon), or better, a null sprite (fully transparent sprite) and use that.
_________________
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.
Back to top
View user's profile Send private message
RooT



Joined: 07 Sep 2005
Posts: 40

PostPosted: Tue Sep 13, 2005 5:58 pm    Post subject: god damnitttt Reply with quote

hah i cant get this to work, so far i have this:

entity (entity cli) Find_Camera = //called pre_think if self.foundcam = 0
{
local entity spot;

self.weaponmodel = ""; //For cam view
spot = findradius(cli.origin, 50000); // find command, this is were i think im messing up, because im not sure what exaclty this does. i believe if searches the specified radius from cli.origin for any entities, and that entity becomes spot. so spot is checked for its classname, wich the camera has as "cam" so it should be found?
while (spot)
{
sprint(cli,"Searching for camera"); //reports that an entity is found
// cli.SVC_SETVIEW = spot; //tried to use that? lol doesnt work tho
if (spot.classname == "cam") // so an entity with cam classname (only the camera)
{
cli.camfound = 1; //will stop searching in client.qc
sprint(cli,"Camera found!");
return;
}
spot = spot.chain; //if no cam found, try another entity?
}
sprint (cli,"No camera!\n"); //if all ent's are not camrea
cli.camfound = 1;
};

void () info_camera = //put in through map editor
{
self = spawn();
setmodel (self,"progs/v_shot.mdl"); // just so i can see it
self.classname = "cam"; //classname used to find in above
setorigin (self, self.origin);
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT;
};//this whole thing may be worng, not sure hah

well you can see i have some idea of what im doing, but maybe not the best. i want when a client's .camfound != 1 it should search for a camera on the map and return that cameras view to the client. ughh this is so aggrivating and essential to this mod lol. well thanks for all your help so far everyone
-Root one
_________________
My mod site!
Mod Status:
Turret Defense: 30%
UPS: 45%
Back to top
View user's profile Send private message AIM Address
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Sep 13, 2005 9:41 pm    Post subject: Reply with quote

somewhere in defs.qc:
float SVC_SETVIEW = 5;


Instead of '// cli.SVC_SETVIEW = spot;':
msg_entity = cli;
WriteByte(MSG_ONE, SVC_SETVIEW);
WriteEntity(MSG_ONE, spot);
cli.angles = spot.angles;
cli.fixangle = TRUE;



in info_camera, strip out the line self = spawn()
inside spawn functions, self is spawned by the engine, and it's fields are filled with the map data.


Personally I'd use the find builtin instead of findradius, but that's just me.

Of course, that code will allow only one camera, but should give _a_ result.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group