Forum

Floating Camera

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Floating Camera

Postby Quake Matt » Mon Oct 30, 2006 7:54 pm

Hi, guys!

I'm going to write a tutorial for a friend about making a floating camera, like you'd get in a spectator mode, but I'm not sure if my way is the right way.

The most obvious way to fly would be to use movetype_fly, but I never got it to work properly. Instead, I left the player on the regular walking movetype and just offset gravity every prethink, making sure to keep fl_onground in check. It works nicely as far as I can tell, but I'm a bit concerned about the effect it'd have on some engines and also how well it'd behave in multiplayer.

As for controls, I hijacked the player's velocity vector every frame to 'read' keypresses. This is handy because I can then write my own movement system but, again, is it the best way?

Thanks in advance!
User avatar
Quake Matt
 
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Postby FrikaC » Wed Nov 01, 2006 10:35 am

I'd say go with movetype_noclip - the benefit is that if the camera is near a wall or floor the velocity measurement taken won't be truncated by a collision and you don't really need to worry about FL_ONGROUND ever appearing/disappearing. As far as keypresses, yeah, that's probably the best method.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Quake Matt » Sun Nov 05, 2006 12:08 pm

I think I'd rather not let the player go through walls, though. Is it possible to use movetype_fly at all, or is that restricted only to non-player entities?
User avatar
Quake Matt
 
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Postby Spike » Mon Nov 06, 2006 11:53 pm

If you are making your own physics then you can prevent the player from going through walls whatever their movetype is.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Quake Matt » Tue Nov 07, 2006 1:23 pm

Hmm, true. Moving brushes may prove problematic, however, but solving it's probably beyond the scope of the tutorial anyway.

I'll play around and see what I can come up with, I guess.

Edit: Silly typo...
Last edited by Quake Matt on Tue Nov 07, 2006 11:26 pm, edited 1 time in total.
User avatar
Quake Matt
 
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Postby FrikaC » Tue Nov 07, 2006 9:23 pm

I think you may have misunderstood me, but I don't have enough energy to sort it out.

Anywho, MOVETYPE_FLY works perfectly well on the player except in umodified QuakeWorld.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Spike » Wed Nov 08, 2006 2:22 am

MOVETYPE_FLY has flat movement direction while noclip has more consistant directions (noclip responds to pitch).

I think...

you could always make a second entity for the camera to represent the solidity. If using noclip the player will harmlessly clip straight through it. Just make it invisible and everything is fine. (with quakeworld, make sure you move the solid ent yourself without relying on movetypes, or make sure you set the 'newmis' entity appropriatly).

Just to clarify FrikaC's comment... Unmodified QuakeWorld is really sucky, and totally ignores the movetype field on player entities, so movetype_fly is no worse than movetype_noclip in this respect.
If you are making a QW mod, just get the user to use zquake / fte and type 'observe'. :)
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Sajt » Wed Nov 08, 2006 2:42 am

I don't think noclip does pitch. Maybe in QW...
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.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest