0
\$\begingroup\$

I have implemented a camera system and a rudimentary physics system. I now have a decision to make regarding steering the camera:

Option 1 - Update the camera movement directly.

eg. position (0, 0, 0) + Key 'W' => position (0, 0, 1)

Option 2 - Apply a force to the camera and let my physic's integration sort it out.

eg. position (0, 0, 0) + Key 'W' + force (0, 0, 0.2) => ...?

How should I implement camera movement?

\$\endgroup\$
9
  • 3
    \$\begingroup\$ Option 1. you want the player to actually control the camera, you need them to have control. Applying force and letting the physics resolve it will give you chaotic results. Keep in mind the camera is not another object in the game, it's your players window to the game. You can use the physics approach with some constrains especially if you want to simulate certain bouncy effect (or other), but generally speaking it's not usually the best approach. \$\endgroup\$
    – concept3d
    Commented Feb 13, 2014 at 3:04
  • \$\begingroup\$ @concept3d But what if the camera is connected to an object? That object will move by having forces applied to it. If we keep the camera in line with the object (a person's head, for example), then the camera is effectively moving under forces anyway. \$\endgroup\$
    – sdasdadas
    Commented Feb 13, 2014 at 3:15
  • 1
    \$\begingroup\$ it doesn't matter if it was connected to object or not, if you can control what is happening then it's ok. I can't remeber any game that I played that have a physics camera, and I think it's mostly for gameply reasons. btw physics objects are usually hard(er) to control, if that camera was in first person, I bet you will hate it. Anyway why don't you try it, if you have the system already implemented it's about changing a couple of lines. \$\endgroup\$
    – concept3d
    Commented Feb 13, 2014 at 3:19
  • \$\begingroup\$ the physics camera may seam easier to implement but you'll need to tether it to the player and you'll need to prevent it from doing odd things like staying behind a wall for too long. \$\endgroup\$ Commented Feb 13, 2014 at 9:54
  • \$\begingroup\$ Okay, one question just to clarify the point; When you say "Camera", do you mean "the player", another similar abstraction? When you're playing Half-Life 2 and you hold W, you're not just moving the camera. You're moving Gordon Freeman, who is an actual physical entity in the game world; and has The Camera attached to his head region. \$\endgroup\$
    – Katana314
    Commented Feb 13, 2014 at 19:58

1 Answer 1

2
\$\begingroup\$

Take a look at the two images below. Both are of cameras. The first is a physical object. You can hold it in your hand and you can smash it to pieces with a hammer. The second is an abstraction. It occupies no physical space, it has no mass and it can't hurt you by falling on your toes.

It makes as much sense to apply physics to such an object as to apply gravity to gas prices or to do collision detection on a horror story. Give control over the camera to the player instead of to the physics engine. You can still use integration to make the camera move more smoothly, but don't apply forces. In fact, keep the entire camera far away from any physical calculations.

Actual video camera
(source: geniusdv.com)

Camera object in 3ds Max

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I disagree. If you apply forces to move the camera, you can get a more natural feeling camera. Just watch the menu of Dungeon Keeper 2: youtube.com/watch?v=D3eD0JLt_HA That's all done with simple equations, and it made me get motion sickness watching it. Maybe it's not always the right thing to do, but it can be. \$\endgroup\$
    – Almo
    Commented Feb 13, 2014 at 14:53
  • \$\begingroup\$ Moving a camera like in the DK2 menu is not the same, because the player has no control over it. From the perspective of the player, the movement is created by moving an actual camera (pic 1) to a new location. This experience actually benefits from having inertial speed, but the way it is observed/experienced is different from having control to look around. In the sacond case, you'd expect to have immediate control. \$\endgroup\$
    – Flater
    Commented Feb 13, 2014 at 15:31
  • \$\begingroup\$ @Almo: I'm not sure I understand. With or without forces, you can move the camera around in exactly the same way. Why would one feel more natural than the other? \$\endgroup\$ Commented Feb 13, 2014 at 16:42
  • \$\begingroup\$ Real objects get moved through interactions of accelerations and velocities. Forces are a natural way to express those. There are certainly other ways to get smooth camera motion, using interpolations and spline stuff. But I think it is possible to use a force model for it. But, for example, if you want a camera to feel like it's in a chase plane, you might want to use a physics object to model its motion. It really depends on the application, which has not been specified in the question. \$\endgroup\$
    – Almo
    Commented Feb 13, 2014 at 18:48

Not the answer you're looking for? Browse other questions tagged .