Few startup questions for a 3D PacMan game

So I’m creating a 3D Pac man game to get to know Unity better. However right from the start, I already have some questions, which I hope you are willing to help me with. Note: I use C# for the scripts! 2nd note: I’ve put quite some time in it already(trying out, watching tutorials,check scripting API), so I’m not trying to be lazy and hoping that I get the answers from you. I’m just kind of stuck right now. Therefore any help would be appreciated. Also if you want to see some code of some parts let me know and I will show it:)

Movement: I want to start off with a relatively simple movement script. I’ve used the getAxis function to get input. But I’m wondering whether it’s useful to use a rigidbody or not. I would like to move as follows: if I press W, I want Pac man to move up. If I press S, I want Pac man to rotate 180 degrees and move down. However I want Pac man to almost instantly stop, and go down rather than braking slowly. Any tips for this?

Camera: I would like to have a 3rd person view. So the camera should always be a bit behind and above Pac man. How should I do this? I’ve tried using an offset, but this doesn’t result in the camera being behind Pac man if he turns. I’ve also tried using the lookAt function but this also isn’t ideal; if I’m going down a lot Then the camera rotates 180 degrees, result: if I press right Pac man moves to the left according to the view (camera rotates but the controls don’t). Maybe any ideas to implement a 3rd person view?

Any help is kindly appreciated. Further information will be given if needed!

Thanks a lot.

1 Answer

1

Movement: Rigidbodies should be attached to everything that you want to move that should interact with the physics system. So if you want the character to collide with things, it should have a rigidbody.

Camera: Do you want the camera to be a 3rd person over-the-shoulder thing? If you want that, you can’t have the character rotating quickly or instantaneously. This is because you’ll get a camera that’s either lagging behind the character’s rotation, so you can’t see the character, or you’ll end up with a camera that rotates too quickly, making your players seasick.

For a packman-like game, I’d recommend not having the camera turn ever, but stay at a fixed distance from your character - think the camera from 2D Zelda games.

If you insist on a over-the-shoulder camera, load up your favourite 3d person shooter, and try to emulate how the camera works there.

First off, thanks for answering :) Movement: Okay, I was thinking about that. Have you any idea if what I want with movement is possible? Do you have tips for implementation? Camera: What exactly do you mean? What kind of view do you have? Like, are you looking at the map from the top, or...?

–