Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Yoseph |
I’m trying to have my character equip a rock, which visually it does but it actually is on the on the ground. When i try to throw it, it starts form the ground not the hand…i searched about this and people said you have to use _integrate_forces()
to move a rigidbody but i don’t know how to make it work.
Anyone who has ideas on how to position my RigidBody2D
rock on my characters Position2D
hand…please help.
This doesn’t really answer your question, but why don’t you just delete the RigidBody from the ground and then add a KinematicBody2D version of the rock in the character’s hands? When you want to throw the rock, you can either swap it with the RigidBody version again or use move_and_slide()
. So the whole sequence is broken down into 3 parts:
-
Pick up the rock. The rock disappears from the ground and a KinematicBody2D version of the rock appears in your character’s hands,
-
When about to throw the rock, delete the KinematicBody2D and spawn a RigidBody rock in its place.
-
Apply forces to the RigidBody rock so that it moves forward or whatever.
johnygames | 2019-08-13 12:51
How do you spawn things in one’s place?
Yoseph | 2019-08-13 15:23