decentraland / decentraland/godot-explorer
[Bug] Raycast hitDistance increases on sloped geometry (mobile only)
- Dominant language
- Rust
- Stars
- 18
- Forks
- 19
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 43
Description
## **⚠️ Problem:**
Scene raycast hit distance is wrong on mobile: on a downward raycast against sloped geometry, `hitDistance` grows as the player walks up a ramp instead of staying at the true ray-origin→intersection distance (desktop is correct). Repro shows `0.08` on desktop vs `1.979` on mobile at the top of the ramp — suggests mobile returns distance to the hit mesh's origin, not the actual hit point.
## **🏁 Scope:**
Fix `PbRaycastResult.hitDistance` computation in the raycast component so it matches desktop (distance from ray origin to intersection point), not the hit entity's transform origin.
## **📝 Deliverables:**
- [ ] `hitDistance` matches desktop value on sloped/ramp geometry (repro scene passes)
- [ ] Regression check against flat-ground raycasts (no change in existing behavior)
## **🔗 References:**
- [stom66/dcl-bugtest-raycast-hit](https://github.com/stom66/dcl-bugtest-raycast-hit) — community repro scene showing desktop `0.08` vs mobile `1.979` at ramp top
- [decentraland/unity-explorer#391](https://github.com/decentraland/unity-explorer/issues/391) — "Implement correct click distance for interactables", same interaction-distance surface on desktop client
- `lib/src/scene_runner/components/raycast.rs` (`do_raycast`) — likely fix location, computes `PbRaycastResult` on mobile
Reported via Discord: https://discord.com/channels/417796904760639509/1545479532901965895/1545479532901965895
**Requested by Mateo via Slack**
Contributor guide
Assessment
This issue has not been assessed yet.