From 1ad654839e354c3921af5c6e283c9b377005d6c1 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Thu, 30 Apr 2026 08:59:32 +0000 Subject: [PATCH] [Auto] [Update] Document object and camera local basis vector expressions for 3D --- automated_updates_data.json | 2 +- .../interface/scene-editor/layers-and-cameras.md | 9 +++++++++ docs/gdevelop5/objects/3d-box/index.md | 10 ++++++++++ docs/gdevelop5/objects/3d-model/index.md | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index 6c71cb99bf9..e80f06ff76c 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -1,5 +1,5 @@ { - "last_automated_updates_commit": "e9b9596d6dddf8fc483ed5d4c2a4725215b073fe", + "last_automated_updates_commit": "ab5866386e680ec5e39b0019abe4d03ddec5b7b2", "last_improved_things": [ { "date": "2026-02-16", diff --git a/docs/gdevelop5/interface/scene-editor/layers-and-cameras.md b/docs/gdevelop5/interface/scene-editor/layers-and-cameras.md index 80a3bf62468..762680dcbcf 100644 --- a/docs/gdevelop5/interface/scene-editor/layers-and-cameras.md +++ b/docs/gdevelop5/interface/scene-editor/layers-and-cameras.md @@ -97,6 +97,15 @@ Camera angle controls the camera rotation. Similar to objects, the default angl ![](/wiki/pres_coord2.png) +### 3D camera direction + +For 3D layers, the camera exposes expressions to get its **local basis vectors** — `CameraForwardX/Y/Z`, `CameraUpX/Y/Z`, and `CameraRightX/Y/Z`. These return the direction the camera is currently facing and its orientation axes in world space. + +This is useful for: + +- Moving a character in the direction the camera is looking (camera-relative movement common in 3D games) +- Implementing first-person or third-person controls where character movement follows the camera's orientation + ### Enforce camera boundaries Many games use a moving camera but they also must prevent the camera from displaying an area outside the game's boundaries. This can be accomplished by using the **Enforce camera boundaries** action after all other camera movement actions. diff --git a/docs/gdevelop5/objects/3d-box/index.md b/docs/gdevelop5/objects/3d-box/index.md index af6541a5686..4123ae5124c 100644 --- a/docs/gdevelop5/objects/3d-box/index.md +++ b/docs/gdevelop5/objects/3d-box/index.md @@ -32,6 +32,16 @@ Support for transparency (faces with transparent or semi opaque colors) can be e This can be produce strange results if you expect other faces of the box to be shown behind. This is due to how 3D rendering works. It's also more costly to render for the 3D engine. +## Object orientation + +3D boxes expose expressions to get their **local basis vectors** — the directions the object considers as "forward", "up", and "right" based on its current rotation. These are available through the **3D object** behavior as `Base3DBehavior::ForwardX`, `ForwardY`, `ForwardZ`, `UpX`, `UpY`, `UpZ`, `RightX`, `RightY`, and `RightZ`. + +These are useful for: + +- Moving the object in the direction it is facing (e.g., multiply the forward vector by a speed value) +- Applying forces or impulses aligned with the object's current orientation +- Building projectile or physics systems that depend on where an object is pointing + ## Performance considerations A lot of 3D boxes can impact your game as they require multiple faces to be rendered, even if these faces are partially or totally hidden behind other 3D or 2D objects. diff --git a/docs/gdevelop5/objects/3d-model/index.md b/docs/gdevelop5/objects/3d-model/index.md index 4a1fff8a058..26b25697848 100644 --- a/docs/gdevelop5/objects/3d-model/index.md +++ b/docs/gdevelop5/objects/3d-model/index.md @@ -97,6 +97,16 @@ The **center location** determines the point around which the object rotates and For characters, setting the origin to "Bottom center (Z)" makes it easy to place them on the ground, as the object's Z position will represent the ground level where the character stands. +## Object orientation + +3D models expose expressions to get their **local basis vectors** — the directions the object considers as "forward", "up", and "right" based on its current rotation. These are available through the **3D object** behavior as `Base3DBehavior::ForwardX`, `ForwardY`, `ForwardZ`, `UpX`, `UpY`, `UpZ`, `RightX`, `RightY`, and `RightZ`. + +These are useful for: + +- Moving the character or object in the direction it is facing (e.g., multiply the forward vector by a speed value) +- Applying forces or impulses aligned with the model's orientation +- Building targeting or aiming systems that depend on where the object is pointing + ## File format GDevelop supports 3D models saved in the **GLB (.glb) format**. It is a standardized file format used to share 3D data. Notably, it includes the 3D mesh of the object, as well as its textures, material specifications, and animations. This format is also sometimes called **GLTF**, for "GL Transmission Format". You can sometimes find .gltf files, but only the **.glb** files are supported by GDevelop, as they can embed the textures and animations whereas .gltf files require separate files.