Expected Result
The impulse's horizontal behavior remains consistent and still applies to the X and Z axes normally regardless of if the player is looking directly up.
Actual Result
When applying an impulse on the X and Z axes, if the player is looking directly up (pitch = -90.0) the resulting horizontal motion of the impulse will be restricted to only one of the aforementioned axes. The impulse functions as if the player's yaw has been clamped and points directly towards the positive or negative sides of the X and Z axes (never both axes at the same time) depending on their current yaw rotation.
Reproduction Steps
Download the attached Data Pack which includes enchantment definitions and functions to demonstrate the bug.
Create a world with the attached Data Pack "apply_impulse X-Z Motion Bug" selected and join it.
Run the function
demo:get_itemsto receive three enchanted dyes named "Left", "Up", and "Left & Up" which apply an impulse in their respective directions every tick when held in hand. Every tick, the Data Pack will also display each component of the player's Motion data tag above their action bar in colored text.Observe how each dye functions as expected until the player looks directly up facing the pitch -90.0.
The dye "Left" will accelerate the player towards their left. When looking directly up, the player will only be accelerated towards +X or -X (whichever their yaw is closer to pointing towards).
The dye "Up" normally accelerates the player upward from where they’re facing. During the bug, they will only accelerate towards +Z or -Z (the closer of the two).
"Left & Up" has both the "left" and "up" enchantments. While the bug is active, the player will only be accelerated towards both +X and -Z at the same time, or the inverse which is both -X and +Z.
Enchantment Definitions
The configuration for the "minecraft:apply_impulse" entity effect that the "left" and "up" enchantment definitions use are as follows:
Left
{
"effect": {
"type": "apply_impulse",
"coordinate_scale": [1, 1, 1],
"direction": [1, 0, 0],
"magnitude": 0.1
}
}
Up
{
"effect": {
"type": "apply_impulse",
"coordinate_scale": [1, 1, 1],
"direction": [0, 1, 0],
"magnitude": 0.1
}
}There is no “forward” enchantment since that can only move the player on the Y axis when they are looking upwards.
Environment
Launched via the official Minecraft Launcher
Java 21.0.7
Attachments
Comments 0
No comments.