Godot Version
4.7
Question
I am making a game and I need sword to follow player. Each have their own GdScript.
I believe I already gave you the answer to this question in the previous topic. Please donât create new topics for questions that have already been answered.
Use look_at()
You did? Sword is looking at mouse but I also need it to follow player
You can lerp the position of the sword so it follows the player smoothly, you can either do this inside the player code with a reference to the sword, or inside the sword itself if the sword has a reference to the player.
See vector interpolation in the docs:
It has really nice code examples.
Alternatively, if your sword is the child of your player, then the sword will follow the player by default anyway, since its transformation will be inherited.
Haha,Your question was too vague for me to understand. I mixed âfollowingâ with looking. Make sure to provide enough description and examples.
And if my post in Sword Swinging Mechanic worked for you, mark it as the solution so other people can find the answer easily.
Define âfollowâ.
Wherever the player goes, the sword goes with it
Add the sword as a child of the player
Is this really needed for the type of game your making?
Yes. Its a PvP arena game