godotengine / godotengine/godot-docs

PhysicsTestMotionResult3D funcs say that their default param index '0' is the deepest collision, but its the earliest

Open
#10,876 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** Godot 4.4.1

**Issue description:**
All method descriptions that return collision query results say **"(the deepest collision by default)"** referring to the default index parameter '0'.

But inspecting the source code it looks like **is the opposing** (assuming that "deepest" means "farthest").
Index 0 really returns the "closest / earliest" collision.

That makes sense because in most cases what is wanted is to know the shortest safe fraction before any collision happens.

engine source links:
https://github.com/godotengine/godot/blob/2d3bdcac35ac22ee6c4d5d5edc88ba947d0659d5/modules/jolt_physics/spaces/jolt_physics_direct_space_state_3d.cpp#L876C1-L928C2

https://github.com/godotengine/godot/blob/2d3bdcac35ac22ee6c4d5d5edc88ba947d0659d5/modules/jolt_physics/spaces/jolt_physics_direct_space_state_3d.cpp#L305

**the key is the sorting algorithm:**
https://github.com/godotengine/godot/blob/2d3bdcac35ac22ee6c4d5d5edc88ba947d0659d5/modules/jolt_physics/spaces/jolt_query_collectors.h#L234

**URL to the documentation page:**
https://docs.godotengine.org/en/4.4/classes/class_physicstestmotionresult3d.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.