# Camera control using keyboard

**URL:** <https://forum.playcanvas.com/t/camera-control-using-keyboard/32321>\
**Category:** Help & Support\
**Tags:** editor, scripting, ui\
**Created:** [July 25, 2023, 7:21pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321 "2023-07-25T19:21:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricardo\_Reyes](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ricardo_reyes/32/25594_2.png) [@Ricardo\_Reyes](https://forum.playcanvas.com/u/Ricardo_Reyes)\
**Post date:** [July 25, 2023, 7:21pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/1 "2023-07-25T19:21:12Z")

</div>

Hello, could someone help me in my project, it is based on the mythical game Super Mario 64, what I want to do is make the player move the camera with some controls like y to the right and u to the left but I can’t do it, any help would be very helpful.  
this is the link of my game: [PlayCanvas | HTML5 Game Engine](https://playcanvas.com/editor/scene/1665542)

---

<div class="post-metadata">

**Author:** ![dadiaar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/dadiaar/32/22384_2.png) [@dadiaar](https://forum.playcanvas.com/u/dadiaar)\
**Post date:** [July 25, 2023, 11:38pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/2 "2023-07-25T23:38:54Z")

</div>

In my opinion that could go wrong at some point, it would be like having 2 sources of truth. You think a X key press will always means an X press for botht he player and the camera, so they will be aligned, but if that doesn’t happen… For example, the player has a wall in front of it, or he has died. The camera will keep moving either way.

If it’s a 2D platform with the player always in the middle, you could start by just parenting the camera to that player.

Another approach would be to make a script that accepts like argument the player, and every frame checks the camera and player’s position. With this you could lerp from cameraPos to playerPos, and also limit the movement from the scenario’s boundaries.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Reyes](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ricardo_reyes/32/25594_2.png) [@Ricardo\_Reyes](https://forum.playcanvas.com/u/Ricardo_Reyes)\
**Post date:** [July 26, 2023, 2:04pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/3 "2023-07-26T14:04:23Z")

</div>

Good morning @dadiaar you have a good point, in case you want the player to move the camera in 3rd person how would it be?

---

<div class="post-metadata">

**Author:** ![dadiaar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/dadiaar/32/22384_2.png) [@dadiaar](https://forum.playcanvas.com/u/dadiaar)\
**Post date:** [July 26, 2023, 2:14pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/4 "2023-07-26T14:14:31Z")

</div>

I’ll reply tomorrow, but can you share a YouTube link for reference?

---

<div class="post-metadata">

**Author:** ![Ricardo\_Reyes](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ricardo_reyes/32/25594_2.png) [@Ricardo\_Reyes](https://forum.playcanvas.com/u/Ricardo_Reyes)\
**Post date:** [July 26, 2023, 2:15pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/5 "2023-07-26T14:15:58Z")

</div>

ok [THIRD PERSON MOVEMENT in 11 MINUTES - Unity Tutorial - YouTube](https://www.youtube.com/watch?v=UCwwn2q4Vys)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Reyes](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ricardo_reyes/32/25594_2.png) [@Ricardo\_Reyes](https://forum.playcanvas.com/u/Ricardo_Reyes)\
**Post date:** [July 26, 2023, 3:06pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/6 "2023-07-26T15:06:36Z")

</div>

[https://playcanvas.com/project/373238/overview/third-person-controller](https://playcanvas.com/project/373238/overview/third-person-controller)  
If someone could help me here I have a playcanvas tutorial but it doesn’t work for me simply the camera is placed in a place far from the entity and I can’t move the entity any help would be appreciated

---

<div class="post-metadata">

**Author:** ![Albertos](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/albertos/32/19749_2.png) [@Albertos](https://forum.playcanvas.com/u/Albertos)\
**Post date:** [July 26, 2023, 6:03pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/7 "2023-07-26T18:03:56Z")

</div>

Maybe one of the example projects below can help you.

> **[Third Person Controller | PlayCanvas Developer Site](https://developer.playcanvas.com/tutorials/third-person-controller/)**
>
> A simple third person controller.

> **[Crash Course - Make a Game | PlayCanvas Developer Site](https://developer.playcanvas.com/tutorials/crash-course/)**
>
> Phase 3 of this tutorial is still incomplete

> **[Touchscreen Joypad Controls | PlayCanvas Developer Site](https://developer.playcanvas.com/tutorials/touch-joypad/)**
>
> Click here to see the project.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Reyes](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/ricardo_reyes/32/25594_2.png) [@Ricardo\_Reyes](https://forum.playcanvas.com/u/Ricardo_Reyes)\
**Post date:** [July 26, 2023, 7:21pm UTC](https://forum.playcanvas.com/t/camera-control-using-keyboard/32321/8 "2023-07-26T19:21:56Z")

</div>

thanks
