r/gamedev•
RedShft

Parallax Issues and Third Person Shooters

Right now I'm developing a third-person shooter and have run into a problem with my camera offset, the position where my weapon trace starts and the crosshair location. The problem I've run into is where it looks like I should be able to hit someone, because of my crosshair but I cannot because the barrel of my gun is behind the wall. I've run into similar issues in other third-person shooters I've played where the crosshair is deceptive in notifying the player that an enemy can be shot.

I've noticed how other games have dealt with this problem by starting the weapon trace from the middle of the screen or starting the weapon trace from the player's shoulder (on the arm with the trigger finger). I suppose that if a game has cover animation it could help with this issue as well.

The team I'm working on is small so new cover animations isn't something we could do right away.

Does anyone have any tricks to dealing with this to make this parallax issue less noticeable?

Posted Feb 23, 2013, 12:16 AM UTC

517
TerraMeliorRPG•

What I'm doing is running a trace from the camera for most weapons. So the bullet actually comes from the camera.

Most spells are guided so I just send them in the general direction they need to go, and for shotguns, I parented the camera to an location marker that is a certain distance in front of it, and I make the bullets so they come from the shotgun toward that location. I had to also make the camera orbit the player closer for shotguns to make it look right, and had to adjust the distance a few times, but it works pretty well now.

3
[deleted]•

I also do this, Fire the trace/bullets from the Camera Location. Im fairly sure a lot of older Games do this (probably still do?). I know Gears of War 1 did, which caused a issue where you could kill players standing behind you! http://www.youtube.com/watch?v=ubtiOZeT2CA

3
TerraMeliorRPG•

I'm planning to make a fix for that by projecting the start of the trace forward a bit. I know tracing from the camera is kinda cheap, but I just don't like the idea of a moveable crosshair, or of using 2 raytraces and IK to make the gun face where the camera is pointing. And even with that, players will have to worry about hitting wall corners.

1
Firzen_@Firzen14•

Laser aiming and just checking for intersection along the line of the laser?

Seems like the simplest solution to me. I might be missing something however.

2
RedShftOP•

I'm not sure I get what you're saying. I don't have a problem adjusting the trace so bullets hit around the crosshair. The problem I have is that it looks like the player should be able hit someone because of where the camera is placed but they can't because of where the weapon trace starts from. It starts from the barrel of the gun, not the camera location.

1
Firzen_@Firzen14•

What I mean is, add an indicator for the player to see what he can hit.

If there is a laser pointer coming from the guns barrel he can easily see what he can hit and what not.

Alternatively, since you seem to have a crosshair you could put the crosshair to where trying to shoot where you are pointing would actually end up firing. As in you start a line from the barrel to your target, but place the crosshair where you would hit instead of where you are aiming.

That way if you can't hit what you want, you will notice immediately, but if there is a clear line of fire it won't make a difference.

2
RedShftOP•

That would be an easy thing to do. I'll look into it.

1
vansterdam_city•

Honestly, I'm not sure if its your responsibility that a player shoots into the wall. Players should be focused on their avatar and if they are shooting at a wall I think thats their own mistake.

Can't you make a wall hit particle system that might give some visual indicator?

0
RedShftOP•

Point taken. I just feel like this issue is a flaw of third-person shooters and I should try to find a way to fix it. I do have a particle system for hit indications, as well as sounds.

2
Azuvector•

Jedi Academy(SDK source is available.) deals with this pretty extensively without using cheats like firing from the camera. Look into that. Don't have time to go into detail right now.

1
RedShftOP•

Alright. I downloaded the source code, I'm going to start taking a look at it. Thanks for the heads up. If you could take some time to go into detail I would appreciate it.

1
Azuvector•

Reading some of your replies here, I think I'm not quite right in saying JKA deals with this directly. But, what's going on there might be useful to you despite that.

Essentially, the game will run a trace from gun to aim point, and correct the crosshair slightly, so it shows what you're actually aiming at, rather than what you're trying to aim at.

It tries to go for the standard center of screen, but as soon as that aiming point starts to diverge from there, the crosshair drifts away from center.

1
RedShftOP•

I see, that's a pretty interesting way of dealing with it. I'm playing a bunch of other TPS to see what they do. It seems like a combination of level design, animation, and some tricks with the crosshair / an indication that your aiming point has diverged would work well.

1
StringLiteral•

Maybe a color-coded crosshair? White when the character can in fact shoot where the camera is aiming, and red if something is in the character's way even if it isn't in the camera's way.

Or you can do it the way the new XCOM did and just let characters fire through solid obstacles because hey, it is good enough for high-budget triple-A games...

1
RedShftOP•

I've seen another TPS do it this way. If your weapon was blocked but your crosshair was on an enemy they essentially put a red X over your crosshair. The trouble is I've seen and played so many third-person shooters that take many different ways around this problem. They use weapon traces from the camera, they have indicators on the crosshair, they trace from the players shoulder, etc etc. One of my friends told me that his studio used a way to manipulate their camera to eliminate these parallax issues in a TPS so needless to say I was pretty intrigued.

1
[deleted]•

From what I've read the solution to this is to begin a trace at the camera location, find the point where that ray hits. Then do a trace from the gun's muzzle to the point the previous ray hit. If you hit something else first, the bullet is blocked and doesn't do damage.

1
RedShftOP•

I'm essentially taking this approach to ensure that bullets from the gun hit the center of the crosshair. Unfortunately it doesn't help with the parallax problem. I take the start fire location, the muzzle location, then trace from the camera location with the trace range of the weapon, and find out if I hit anything. If I hit something I take this hit location and subtract this by the start fire location. I then use this vector to properly compute the end trace location for the shot. The end trace location would be the aim adjustment vector + the pawn's rotation mutiplied by the weapon range. If this trace hits something then I inflict damage. I'm guessing that's essentially what you stated.

1