Godot Version
Godot 4.6.2
Question: ShapeCast3D snaps after jumping near a StaticBody3D
Hello everyone! I am running into an issue where my ShapeCast3D node gets permanently offset from my character model after I jump near a StaticBody3D.
Before jumping, the ShapeCast3D is perfectly aligned with my character. However, after a jump, it becomes misaligned. This bug allows the player to press the jump button again before their feet even touch the ground (StaticBody3D).
public partial class Player : RigidBody3D
{
private bool _isOnGround;
private bool _jumpPressed;
public override void _Ready()
{
_groundRay = GetNode<ShapeCast3D>("GroundRay");
}
public override void _UnhandledInput(InputEvent @event)
{
if (@event.IsActionPressed("jump"))
{
_jumpPressed = true;
}
}
public override void _PhysicsProcess(double delta)
{
_groundRay.ForceShapecastUpdate();
UpdateGroundState();
if (_isOnGround && _jumpPressed)
{
_jumpPressed = false;
ApplyCentralImpulse(Vector3.Up * (JumpVelocity * Mass));
}
else if (_isOnGround)
{
_jumpPressed = false;
}
}
private void UpdateGroundState()
{
_isOnGround = _groundRay.IsColliding();
}
}
with the images proof shown as below :


