|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
prosta4ock |
|
Old Version |
Published before Godot 3 was released. |
Hi.
Tell me please how to make drag and drop physical objects (RigidBody2D)
I did, but I do not like the behavior of the body. I want to implement such a video.
|
|
|
|
Reply From: |
Vincent Scalia |
Under your if(Input.is_mouse_button_pressed())
try a line like this:
set_pos(Vector2(get_viewport().get_mouse_pos())
this will set the object to the vector current position of the mouse. Once you release the button, the object should continue it’s physics as normal.
|
|
|
|
Reply From: |
prosta4ock |
Maybe someone will need.
I decided to do it:
var r = Vector2(get_viewport().get_mouse_pos() - get_pos()) * speadDrag;
set_linear_velocity(r)
ooh. thats a good idea!
Vincent Scalia | 2016-06-06 20:26