Godot Version v4.5.1
I’ve been struggling with a rigidbody2D problem lately. I’m recreating the Stardew Valley fishing minigame, so I’m using the mouse to apply an upwards force onto a rigidbody2d object. However, when I hold onto the mouse and keep the bar at the top of the screen too long, it appears that the collision of the rigidbody2d and the ceiling of the bar get stuck together as the rigidbody2d object stop moving. It can touch the top of the bar briefly, but any longer for about a second or two causes it to be stuck.
I’ve messed with the physics materials and collision detection type, but have had no luck. I suspect it has to do with how I use apply_force(), but I’m not sure where to go from here. Any help would be appreciated. Thank you!
extends RigidBody2D
var moving = true
var startPos : Vector2
var thrust = 2000.0
func _ready() -> void:
EventBus.gameEnd.connect(_on_game_end)
startPos = position
func _physics_process(delta):
if not moving:
return
if Input.is_action_pressed("Push"):
apply_force(Vector2(0,-thrust * global_scale.y))
func _on_game_end(status : bool):
moving = not status