Hello all!
I'm having a bit problem while dealing with RigidBody and collision.
What I'm doing is instancing some nodes while clicking a button, a new node is instanced in a different position.
Those nodes need to be able to move by drag and drop on mouses, and initially, I did with Area2d nodes and it was working fine, however, I need it to handle collisions and I used the same principle for moving it.
The problem is that when I move using a rigid body, the movement appears to be limited to the rigid body area itself.
Trying to change the rigid body to a character also has the same effect, however, it resets to the initial position.
Note that in the background, there is a Are2d, however, to avoid issues, I also changed the layer/mask, however, no luck.
Here is the code I'm using to move them.
var id
var MouseIn = false
signal MouseIn
signal MouseOut
func _ready():
set_process(true)
pass
func add_peca(id):
print (id)
pass
func _process(delta):
if(MouseIn == true && Input.is_action_pressed("click")):
set_position(get_viewport().get_mouse_position())
pass
func get_MouseIn():
return MouseIn
func _on_mouse_entered():
MouseIn = true
emit_signal("MouseIn")
pass
func _on_mouse_exited():
MouseIn = false
emit_signal("MouseOut")
pass
Do you know what i'm doing wrong? It's the movement script itself or there is any property i'm not aware that cause it?