![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Nils |
Hello,
how it is possible to move a kinemtic Body 2D from point A to B, if it for example touching a wall or somthing like that.
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Nils |
Hello,
how it is possible to move a kinemtic Body 2D from point A to B, if it for example touching a wall or somthing like that.
![]() |
Reply From: | simonmakesgoodgames |
Hello,
Once you find the trigger for moving a kinematic body to point b, just open the script for your kinematic body and do
position = Vector2(xxxx, yyyy)
You can also make point B a variable, like
var point_B = Vector2(100, 200)
position = point_B
so you can change where point b is at any time, like at the press of a button
func _on_SomeRandomButton_pressed():
point_B = point_B + Vector2(50, 50)
then
position = point_B
Thanks for the quick answer
Nils | 2019-11-25 15:59
![]() |
Reply From: | Dlean Jeans |
Simply:
body.position = new_position
Thanks for the quick answer
Nils | 2019-11-25 14:49