godotengine / godotengine/godot

Input events registered at a wrong position visually on CharacterBody3D when linear axis locked is enabled.

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

Description

### Tested versions

4.2.1, 4.3dev

### System information

Windows 11 - Vulkan - Nvidia RTX 4070 - intel i5 13600KF

### Issue description

When you enable linear axis lock for let's say Y axis and move the body in that axis through setting it's position (or set the position first and then lock the axis) then the `input_event` and `mouse_entered` and `mouse_exited` signals are triggered at wrong positions as if the body did not move.

I understand this is realted to PhysicsBody3D and then it probably doesn't expect position change in the axis which is locked but:
1. It's still weird since you can move the body around through code or in editor as long as you just change the position.
2. The description to the lock says `Lock the body's linear movement in the Y axis.` it doesn't talk about direct changes to position so I'd assume this means move_and_collide (or otherl inear movement for RigidBody3D)

I'd assume that you can move the body somewhere and then lock it but it does not update the position for where the even it triggered at.
Or if nothing else at least the documentation should reflect this so I'd say it's either bug or unintuitive behaviour which needs to be documented - perhaps even including the popup hints in the editor.

### Steps to reproduce

Play the MRP and hover over the box, nothing gets printed in the output then hover below it where the origin would be until you start triggering the events

- OR build your project: -

1. Add CharacterBody3D.
2. Connect to any of it's input events mentioned above.
3. Lock linear axis Y.
4. Move the body in Y axis up.
5. Play the project and see that the event isn't triggered when you mouse over the object but only at the place where it was before moving it where the object currently isn't.

### Minimal reproduction project (MRP)

[Tttttt.zip](https://github.com/godotengine/godot/files/14437104/Tttttt.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the linked Tttttt.zip minimal reproduction and confirm the event positions after locking the Y axis and moving the CharacterBody3D. Trace the CharacterBody3D linear-axis-lock and 3D input-event handling involved in the reproduction. Done means hover events follow the body's current position, or the documented behavior and editor hints clearly explain the limitation.

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.