Top Down mobile game in isometric 3D - Free Camera

Godot Version

4.2

Question

Hello everyone,

To learn Godot, I decided to try to make an isometric 3D game on mobile as a first project.

I have gone through numerous tutorials, documentation, and the intricacies of Google, but I cannot resolve my problem, so I am asking for your kind help.

Below is how the main scene is configured:

  • (Node3D) World
    • (DirectionalLight3D) DirectionalLight3D
    • (NavigationRegion3D) NavigationRegion3D
      • (Node3D) Terrain
    • (Node3D) CameraGimbal

I created a Terrain on Blender with a certain relief (hills, mountains).
And imported it like this in Godot:

  • (Node3D) Terrain
    • (MeshInstance3D) Terrain
      • (StaticBody3D) StaticBody3D
        • (CollisionShape3d) CollisionShape3d

I try to make the height of the camera (Y axis) always at the same distance from the ground.
So, if the camera moves over a mountain, the height of the camera will follow the curve.

I tried adding a RayCast:

  • (Node3D) CameraGimbal
    • (Node3D) InnerGimbal
      • (Camera3D) Camera
    • (RayCast3D) RayCast3D

With Target Position Y = -100

In order to detect the ground and its distance from the camera, but I can’t get the Raycast to detect the terrain, even when the camera collides with the terrain.
(RayCast is enabled, as well as Collide with Aeras and Bodies)

Does using a RayCast suit my needs?
If so, what is missing for my RayCast to collide with my ground (CollisionShape3d)?

Thank you very much in advance for your time and help!

Maybe this example will help you.

Godot 3, but I was able to convert and port it (GdScript, 2 lines adjusted)

1 Like

Hi @alex2782,

Thanks a lot for sharing this archive that you updated.


This is a perfect example for a 3D-isometric game with one character, but I’m trying to do it with a free camera (which detects changes in ground height to keep the same Y distance from the ground).

Should I create an invisible CharacterBody3D, that can only collide with floor?
(Or same with another kind of 3d object ?)

Is there other ways to detect the relief (Y) of my terrain per X.Z position ?
(Because I can only get position of the global object…)

Thanks.

I’m not sure how yet, what does your GdScript look like? And your ‘RayCast3D’ configs.

Probably the easiest way to troubleshoot would be to share your project (e.g. GoogleDrive. Zip files are blocked here in the forum)

I have extended another example, via HightMapShape3D in CollisionShape3D I was able to check “distance_to_camera” and “height_above_camera”. Godot has a useful debug function, it RayCast turns red when it hits an object.

Bildschirmfoto 2023-12-14 um 00.30.43

1 Like

Hi @alex2782,

Thank you so much for sharing this second archive!!

As a beginner, it wasn’t easy at first, but I played around with this project a lot and finally figured out how RayCast works.

I have not yet had the opportunity to resolve my problem in my project, but I should be able to do so better thanks to you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.