godotengine / godotengine/godot

When Camera is enabled, the ParallaxLayer/Tilemap Physics Layer is calculated inaccurately using is_on_floor()

Open
#88,752 2 comments 0 reactions 0 assignees View on GitHub
bug needs testing topic:2d topic:physics
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

v4.3.dev3.official [36e943b6b]

### System information

Linux Kubuntu 23.04 KDE Plasma Version: 5.27.4 KDE Frameworks Version: 5.104.0 Qt Version: 5.15.8

### Issue description

The `is_floor()` function reports incorrectly (or is off) when being applied to a ParallaxLayer Tilemap and a Player with Camera enabled. If camera is disabled, then is_floor() works correctly.

### Steps to reproduce

Create a CharacterBody2D Player with a camera. Also create a ParallaxLayer and a TileMap floor with a physics layer collider. When the Player drops to the floor it will not stop at the floor but somewhere else depending on the ParalaxLayers position.

Project
![project](https://github.com/godotengine/godot/assets/930478/97b82af4-4ad7-41d5-ba6a-504806cf023f)

Camera Enabled
![TilemapCamEnabled](https://github.com/godotengine/godot/assets/930478/46533874-05e5-4bde-babc-7f4aa49cc746)

Camera Disabled
![TilemapCamDisabled](https://github.com/godotengine/godot/assets/930478/0c551fe5-6612-4de8-a15e-58e0306d2636)

### Minimal reproduction project (MRP)

[Archive.zip](https://github.com/godotengine/godot/files/14391638/Archive.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached Archive.zip minimal reproduction and compare the CharacterBody2D, Camera, ParallaxLayer, and TileMap physics-layer behavior with the camera enabled and disabled. Trace how floor detection is calculated in this setup; done means the player stops at the TileMap floor consistently regardless of the ParallaxLayer position and is_on_floor() reports correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.