Skip to main content
GameDev.net gamedev.net
🔒 Locked

Camera system for third person shooter

Started by Spk Apr 16, 2008 at 5:06 AM 10 replies 6k views
Original Post
Spk
Spk
Hi! I'm currently working on a prototype of a third person shooter game I've had in a mind for a while. I'm using the quake3 engine as my prototyping platform. At the moment, I'm focusing on the camera system. My current implementation uses polar coordinates to easily position the camera around the character using an azimuth, zenith and distance to pivot point. The pivot point is located a few units above the player's head, so that you don't get your character model in the way. It simply occupies the lower region of the screen. However, this offseting introduces a new problem: it also offsets the aiming point of the player. The hud crosshair no longer points at the location the missiles/bullets are expected to hit. I'm probably not the first dude trying to do that, so I was curious if anyone has faced this problem before and how they solved it. And I don't want to shoot from the camera origin: bullets and missiles have to come from the player weapon's muzzleflash point. The only decent solution that I've been able to figure out so far is to dynamically update the player character direction to face the point the camera is looking at. It would involve the following steps: * chasecam pivot = get current character head origin + offset (X units up) * use current character's yaw/pitch angle to position the chasecam in its back, applying any extra polar coordinate offsets (distance,azimuth,zenith) * orient the camera to face the pivot point * trace a ray from current camera position along the camera direction to find the closest intersection point with the world. We'll call it the focus point of the camera * adjust the character entity orientation to face this focus point Any other suggestions/critics/comments?
umbrae
umbrae
I'm sure this has been discussed before, but I don't have any specific resources to share. I can see these solutions:

The solution you presented, the character aims at whatever is under the crosshair.
No crosshair, the actual trajectory endpoint is drawn as a dot (Max Payne)
Use over-the-shoulder perspective instead and aim along the character's weapon sights.
A transparent line and brighter dot where a bullet would hit.
Another option is to not worry about it. As long as the character is aiming towards where the crosshair is pointing it's fine. As a game I have become used to games having the bullets come from a different location than the crosshair.

Some games such as Gears of War have started displaying the trajectory of lob projectiles in realtime. My guess is it's a quick incremental solve of the physics system.

I would recommend Quaternions instead of polar co-ordinates, if only because I think they are awesome.
Spk
Spk
Yeah I also use quaternions in my C++ and C# engines but Quake 3 doesn't have built-in support for quaternions and is written in C so I didn't bother adding support for them yet as this is just a prototype to spot unforseen issues beforehand such as this camera problem that only really became apparent to me as I tried to frag some bots with it :)

I want to retain a HUD-based crosshair as I don't want it to move around the screen depending on where you're looking at. Thanks for your suggestions though, there were some pretty good ones in the lot that got me thinking :)
zedz
zedz
Quote:
Some games such as Gears of War have started displaying the trajectory of lob projectiles in realtime. My guess is it's a quick incremental solve of the physics system.

ive never played it, but i believe for the gun weapons (from what ive seen in a video) gears of war actually shoots from a first person perspective. ie its not a true third person shooter.
this works quite well if u dont actually see the bullets, but things like missile launchers etc are out of the question, in which case u switch back to the displaying the missiles/grenade trajectory as above

kiwibonga
kiwibonga
Just shoot the bullet from the bottom right of the center of the camera:

           |           |           |           |-----------+-----------           |[bullet]           |           |           |


Because of perspective, it'll look like it came out of the weapon, but it'll really hit the center of the crosshair.
umbrae
umbrae
Quote:
Original post by zedz
Quote:
Some games such as Gears of War have started displaying the trajectory of lob projectiles in realtime. My guess is it's a quick incremental solve of the physics system.

ive never played it, but i believe for the gun weapons (from what ive seen in a video) gears of war actually shoots from a first person perspective. ie its not a true third person shooter.
this works quite well if u dont actually see the bullets, but things like missile launchers etc are out of the question, in which case u switch back to the displaying the missiles/grenade trajectory as above


Aiming in Gears of War is over-the-shoulder perspective, still 3rd person but different enough to be given a new name.
oliii
oliii
aiming in 3rd person is done by doing a ray cast from the camera centre, find the intersection point with the world, and use basic inverse kinematic to have the character move his arms and aim his gun to that particular point.
Everything is better with Metal.
zedz
zedz
Quote:
Aiming in Gears of War is over-the-shoulder perspective, still 3rd person but different enough to be given a new name.

i dont think so, its just first person like all the FPS's eg quake
a method similar to what oliii saiz.
like i say most ppl are not gonna notice the difference (unless u have slow projectile weapons)
kiwibonga
kiwibonga
Gears of War is third person. The character is always visible, even when aiming.
umbrae
umbrae
Quote:
Original post by zedz
Quote:
Aiming in Gears of War is over-the-shoulder perspective, still 3rd person but different enough to be given a new name.

i dont think so, its just first person like all the FPS's eg quake
a method similar to what oliii saiz.
like i say most ppl are not gonna notice the difference (unless u have slow projectile weapons)




Are you meaning something else about the perspective? The location from where the bullets come from? I notice that bullets still hit their target even when an obstacle blocks their trajectory but not the crosshair.

[Edited by - Umbrae on April 18, 2008 9:08:11 AM]
zedz
zedz
this photo is a perfect example taken from a film

based on the angle of the gun it shuld be shooting more in the green line direction (but anyways)
u can see where the sights are in front of the monster, now hes shooting the monster (+ u see blood etc) but when he misses instead of the bullets ending up where the should do (somewhere over where the yellow circle is) they instead end up in the pillar behind the monster, u can see the smoke clouds from the bullet hits.

Quote:
Gears of War is third person. The character is always visible, even when aiming.
we're talking about in what mode the person shoots in GOW its plainly first person, unless its lobbing granades etc when it switches over to third person aiming + because its far harder to aim in third person (than 1st person) they draw the trajectory onscreen
umbrae
umbrae
Ah, I know what you mean now.

When I said "Aiming in Gears of War is over-the-shoulder perspective" I was meaning the perspective while aiming, not firing or how the bullets travel. I have no doubt that the firing mechanism used in Gears of War is similar to firing mechanisms used in first person games. But that doesn't mean Gears of War is first person.

People don't really talk about 'first person shooting mode'. First and third person perspectives refer to the character.

In Jurassic Park Trespasser you actually move the gun around and shoot in the direction the gun is aimed, but the game is still in first person perspective.

When describing different firing modes it would be confusing to call them first or third person because first and third person already have well defined definitions.

First person perspective is from the view of the character.
Third person perspective is from an external view, outside the character.

The key word here is 'perspective', these definitions don't apply to how bullets travel.

I would love to see better terminology for game development, perhaps we can differentiate these two ways of firing by calling them 'gun based' or 'crosshair based'.

[Edited by - Umbrae on April 19, 2008 9:22:59 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.