Godot Version
4.3
Question
`how can I make the cube that I hold with the mouse cursor react with other objects?
so it would look something like this
this is my current code
extends RigidBody2D
func _gui_input(event) -> void:
if InputEventMouseMotion and event.button_mask == 1:
global_position = get_global_mouse_position()
thank you for your attention)
`
RigidBodies do not like their position being modified directly, instead it’s better to apply forces in the direction you want it to go.
Here’s a link to a thread on a similar subject, in 3D. The Vector mathematics should apply all the same.
2 Likes