Author Topic: CastleEngine Navigation setting  (Read 1948 times)


  • Sr. Member
  • ****
  • Posts: 270
  • Knowledge is the key
CastleEngine Navigation setting
« on: April 16, 2020, 07:59:13 pm »
How can I set the navigation?
I downloaded some navigation file what I can open with "view3scene" and working,
but I cant use these in my project.
And I want to make my own navigation style.
But... How?

(I'm just learning CastleEngine's basics and I read the info on web, but that's the result) :'(

Eugene Loza

  • Hero Member
  • *****
  • Posts: 576
    • My "almost daily" development blog
Re: CastleEngine Navigation setting
« Reply #1 on: April 16, 2020, 09:44:16 pm »
Hi, Jake!
And I want to make my own navigation style.
Depends on what are you trying to achieve by your own navigation style. Tell what do you want your project to do so that I or someone else can help you more specifically.

Note that there are two things that may be called "navigation":

First one is the TNavigationInfoNode node (see often found inside of the X3D file, generated by Blender.

Or there is a new feature of the latest 6.5 version of Castle Game Engine, called TCastleNavigation (see which improves the recent behavior of the TCamera.
For most tasks you should be perfectly enough with 2 presets inside the Castle Game Engine: TCastleWalkNavigation for FPS-like movement in the scene, or TCastleExamineNavigation suitable for most other purposes.

If you really need to create "your own navigation style", you can simply override one of those, e.g. like here
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
(and some ancient games in Turbo Pascal too)
Sources are here:


  • Full Member
  • ***
  • Posts: 114
    • Castle Game Engine
Re: CastleEngine Navigation setting
« Reply #2 on: April 16, 2020, 10:09:51 pm »
To easily set the navigation, you can set TCastleViewport.NavigationType to ntWalk, ntFly, ntExamine, or ntNone. See .

To control the navigation more, create an instance of TCastleExamineNavigation or TCastleWalkNavigation, or your custom descendant  of TCastleNavigation, and assign it to TCastleViewport.Navigation. This way you can control every aspect of the navigation. It can be as simple as this:

Code: [Select]
  Navigation := TCastleWalkNavigation.Create(Application);
  Navigation.MouseLook := true;
  Navigation.PreferredHeight := 1;
  Navigation.MoveHorizontalSpeed := 10;
  Navigation.Radius := 0.1;
  Viewport.Navigation := Navigation;

(Example from examples/3d_rendering_processing/build_3d_tunnel.lpr in CGE sources)

You can also just leave TCastleViewport.Navigation at nil, and control camera from any other place in your code. You can call, at any time (e.g. in some OnUpdate) TCastleViewport.SetView method to set position, direction and up vector of the camera.

More information is in the manual: Chapter "Loading, displaying a scene (simple loading of 3D models)" has a section "3. Set the camera and navigation".


  • Sr. Member
  • ****
  • Posts: 270
  • Knowledge is the key
Re: CastleEngine Navigation setting
« Reply #3 on: April 17, 2020, 09:36:14 am »
I'm just wanted to optimalize the default navigation.


TinyPortal © 2005-2018