I make a top down 2d gungeon like game. I don’t know how to make a arm system. I need to make a hand that would follow the camera along a limited arc and change its position depending on the direction of the cursor. Example in picture
You can get the position of the player and the position of the mouse (or the camera, or wherever you want to aim at).
See Vector2 — Godot Engine (stable) documentation in English
There are various functions in Vector2 which will help here:
angle_to_point(vec2)
- will tell you what angle you need to rotate the gun spritedirection_to(vec2)
- gives you a normalized (that is, length 1) vector that you can use for the bullet – multiply it by some value to change the speed- other similar stuff
You can do things like look at what angle_to_point()
gives you to check whether the angle is within your restricted arcs. You can clamp that angle to your arcs, and use your clamped angle to rotate a vector to determine where to place your gun.
Everything you need should be in Vector2.