Third-Person Navigation (with Avatar) component in Castle Game Engine

third_person_camera_screen_2
third_person_camera_screen_3
third_person_camera_screen_4
third_person_camera_screen_6
fps_game_screen_5
fps_game_screen_6
fps_game_screen_7

We present a new Castle Game Engine component TCastleThirdPersonNavigation. You can use it easily with TCastleViewport to have a working 3rd-person navigation. This means that you control an avatar with keys (ASWD QE), and the mouse orbits around the avatar, who is displayed and animated in front of the camera.

Features:

  • You can move the camera around the avatar and control the avatar in various ways. All the inputs are configurable.
  • Avatar can run, crouch, with collisions, with gravity.

  • Camera follows avatar smoothly and avoids being blocked by walls.

  • Mouse can optionally also “aim” the avatar, which makes it easier to rotate the avatar. OTOH, it makes it harder to look at avatar’s front, e.g. at avatar’s face.

  • You can look closer/further at the avatar.

  • Avatar can have gravity enabled, so it can fall down and climb stairs correctly.

It is all documented in our API. There’s a lot of published properties to play with.

You can trivially use it with CGE editor. Just select a viewport and, using the menu, change the Navigation to be TCastleThirdPersonNavigation. Remember to also assign the Avatar property

The full demo is in engine sources, in examples/third_person_camera. Just download the latest engine and open “examples/third_person_camera/” project in the CGE editor.

The examples/fps_game was also updated to show how to use 3rd-person navigation together with TPlayer and TLevel classes. Just uncomment SetupThirdPersonNavigation call in the sample code to have it working.

This work has been sponsored through Castle Game Engine Patreon. In particular thanks to Ramazan Geven and Robert Daniel Murphy for donating and requesting this feature! If you like what I’m doing — please support me on Patreon. Thank you!

2 Likes

Great feature, thank you