Navigation handles user input (key presses, mouse movement, touches on mobile devices, …) to move the camera.
You can assing any instance of TCastleNavigation
class to TCastleViewport.Navigation
. As TCastleNavigation
class is abstract, you actually have to use some descendant of it, like:
TCastleWalkNavigation
- typical first-person 3D navigation. Depending on the TCastleWalkNavigation.Gravity
value, it feels more like walking (when Gravity
is true
) or flying (when Gravity
is false
).
TCastleExamineNavigation
- inspect the 3D model, moving and rotating it to easily look at every side.
TCastle2DNavigation
- specialized navigation for 2D. Makes it easy to move a 2D world, without accidentally making a rotation that would reveal it is 3D.
TCastleThirdPersonNavigation
- 3rd-person navigation in which an avatar of the player is shown. This navigation requires an animater avatar to use, see examples/third_person_camera how to set it up.
You have complete freedom how do you handle the input in your games. You can
use one of our ready navigation classes listed above,
or implement a new descendant of TCastleNavigation
,
or leave TCastleViewport.Navigation
as nil
and handle the navigation elsewhere. For example, move the camera in response to user input in your TStatePlay.Update
.
See the Tutorial: Designing a 3D world and Tutorial: Designing a 2D world to see the typical workflow how do you manipulate the navigation using the editor.
To improve this documentation just edit the source of this page in AsciiDoctor (simple wiki-like syntax) and create a pull request to Castle Game Engine WWW (cge-www) repository.
Copyright Michalis Kamburelis and Castle Game Engine Contributors.
This webpage is also open-source and we welcome pull requests to improve it.
We use cookies for analytics. See our privacy policy.