Long story short: I've switched to a third person - top down perspective. The camera is fixed and looks down at the player. How can I implement 3d aiming ? The player needs to aim left and right as well as up and down.

details: I've ditched the first person perspective in my current project - I wouldn't call it a game yet, it's more of a test-case. Instead I'd prefer a third person perspective with the user looking down at the player (slightly tilted to the back). The implementation is no problem, the aiming system is. Although the player will be rarely armed there will be situations where he's allowed to return fire.

This is more complicated than it sounds since the player needs to aim up and down. I hope you can envision my problem. In an ego shooter moving the mouse let's the player look up/down and left/right . In a top/down game the mouse points in the direction the player is moving. I'm currently casting a ray from the camera and the player looks at the first collision point of that ray. That means to aim at an enemy the player just needs to hover the mouse over him. Not very comfortable, no skill required at all.

I've thought about this: The player is always centered on the screen, the mouse 2d coordinates are computed to a 2d vector that is used as the player's viewing direction. This way he couldn't look up or down but then again that's only visuals the camera wouldn't be moved in any case. In order to shoot the player presses the right mouse button. The mouse movement is now mapped to the player just as in any common shooter. Mouse up -> look up. Mouse left -> turn left. Don't misunderstand me: I don't intend to move the camera only the player charaTo show the player where he's aiming I then draw a line to his target (or a cone for less precise weapons).

What are possible pitfalls ? Have you done something like this and can tell me if it's usable ? I've never played a game that worked this way and just wonder if it's a good idea

UPDATE: I've accepted an answer but of course I'm still interested in other options. If you've got a good idea that fits here I'd highly appreciate it.

  • \$\begingroup\$ @downvoter care to comment ? \$\endgroup\$ – lhk Jan 16 '12 at 17:08
  • 2
    \$\begingroup\$ I voted to close this for the same reason that I voted to close your other question. "How can I implement 3D aiming?" is too broad a topic. It looks like you might have an idea of what you want your more specific requirements to be but they're very hard to read inside that wall-of-text second paragraph. \$\endgroup\$ – user1430 Jan 16 '12 at 17:54
  • 2
    \$\begingroup\$ The site is for questions and answers to specific problems, it isn't for open-ended, subjective, discussion-oriented, et cetera, types of questions (see the FAQ for details). Those types of questions belong elsewhere, on forums like (GDNet)[gamedev.net] or in the chat. \$\endgroup\$ – user1430 Jan 16 '12 at 18:42
  • 2
    \$\begingroup\$ Well I butchered my GDNet link. Your recent edits clarify your problem better, but your ending query is still a discussion one, for example. If you instead describe your attempted approach (as you have) and then ask what potential usability or technical issues might exist with that approach, it would be a far more focused and appropriate question. \$\endgroup\$ – user1430 Jan 16 '12 at 18:55
  • 1
    \$\begingroup\$ Have a look at Kong360 for one concept of how to get this to work. \$\endgroup\$ – Jonathan Dickinson Jan 16 '12 at 19:36

If you're going to ask the user to aim up and down, you need the player to be able to judge those up and down distances. With a static top-down camera, that is virtually impossible, and grossly unfair of you to demand of the player, no matter how you map it to controls.

If you're set on using a top-down camera, then your player character should handle aiming up and down automatically, be generous about allowing the player to fire through floors and ceilings (again, because the player can't judge those firing angles due to of your choice of camera), and only ask the player to aim along the axes that you allow him to view (that is, the flat ones)

  • \$\begingroup\$ +1 that's exactly the kind of answer I was looking for. However you forgot that I wanted to draw a line to the target to let the player judge where he's firing. Is that going to be enough ? Do you think I should move the camera for the player to aim ? That would mean two camera positions: Flying high over the scene and then hovering a few meters behind the player. \$\endgroup\$ – lhk Jan 17 '12 at 8:56
  • \$\begingroup\$ I don't think that a simple line will do the job; with the camera position as you've described it, you won't be able to tell the angle of the line along the Z axis, and it won't actually help with aiming. I really feel that when using a top-down camera, you really need to make the game effectively two-dimensional. \$\endgroup\$ – Trevor Powell Jan 17 '12 at 9:38
  • \$\begingroup\$ you're right. I hadn't realized that one has no depth perception when looking vertically down at the line. I don't want to limit my game to 2 dimensions though so I guess I'll go for auto aiming. That's not what I wanted but probably the best bet anyways. \$\endgroup\$ – lhk Jan 17 '12 at 10:39
  • 1
    \$\begingroup\$ Treat the collision detection like it is 2D, and snap the aim to the target's vertical location. Auto-Aim and 2D targeting are the same thing. \$\endgroup\$ – DampeS8N Jan 17 '12 at 16:04
  • \$\begingroup\$ Most such games seem to zoom into first person during aiming, as far as I've seen. This works if it's quick, the graphics cater for that perspective and shooting isn't the single game mechanic. \$\endgroup\$ – Oskar Duveborn Jan 18 '12 at 12:38

Use storyboards and blocked out animations to preview game play changes, both are easy to create and cheap to modify until you arrive at a solution. Movie studios call this "prefiz" and use it to save money and effort.

You can animate several new viewpoints in a day and save a week of coding.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.