How to make a walking " feel "camera for a 3d game?

How do I…

How to make a camera movement loop, that makes the player feel like he’s making steps ( walking) , breathing ( idle ), and running in the first person view ?

What is the expected result

10:50 ( Running, walking ). Skip to 10:50 !

When (Key W is pressed) OR (Key A is pressed) OR (Key S is pressed) OR (Key D is pressed):
- Loop:
    - Set Z position to Z position + 10
    - Wait for a short time
    - Set Z position to Z position - 10

When NOT (Key W is pressed) AND NOT (Key A is pressed) AND NOT (Key S is pressed) AND NOT (Key D is pressed):
    - Loop:
        - Idle the camera (perform actions for camera being idle)

What is the actual result

This is probably a right direction to look for but the Z order even thought it changes it gives just a short effect when the value is added and not when subtracted.

Related screenshots

This is barely working :

the value gets subtracted, but there is not the same effect as for the addition.

This is because there is no wait event after the subtract one. Try adding it there and see if it helps

I would consider something like:

What I haven’t factored in is when the “w” key is released and returning the camera to the initial z position.

This didn’t seem to work. I might not have explained it well, I wanted it so it loops not so it ends in one iteration. What happens is, it lifts the player up for that Z position, and places him down when the key is released.

I tried your solution, it doesn’t seem to loop when w is pressed ? I tried holding the w, and it changed the z position of the camera a bit odd. But if I hold it and release it quickly it just acts as mine first event above.

Have figured it out, I have missed it before somehow :}

It can be changed for fast running too.

0.5 is too small as an increment. Try a larger number, like 10. Here’s what it looks like for me:


Which is done with these events:

1 Like

Thanks, yours looks much more realistic, I have tried it, looks cool.

1 Like

Sorry again, so now the walking works, but there is a slight offset when the key is released. Can you maybe add the event for the ’ w’ key released as you mentioned ? And if you have the time to care, the idle, should i make it with screen shake so it dosent look the same as walk, that was my first idea, as I am quite bad with tween. And for the run i guess the camera unzoom, camera shake and speeding up the walk.

I’ve had a rethink about that, and think a slightly modified approach is better:

I’ll let you read through it and figure out what it’s doing.

And I’ll leave it for you to figure out how to do idle. Personally, I wouldn’t do a shake. I probably wouldn’t do anything for idle at all. Just leave it still.

1 Like