Late line drawing

hi guys I find myself once again fighting with the drawing of the lines.
the line does not follow the point of the weapon, I am attaching a small example so that I can understand what is happening to me.
i hope for your help i can’t figure out how to get around this problem

Move the weapon first, then get the default values, then do the raycast and finally the draw actions.

You were getting the target position relative to the weapon first, then moving the weapon, meaning the target position is out of date.

yes I just succeeded in the example sent but not in my definitive code.

the player’s movement is handled first:

subsequently the taking of the weapon:

now the rotation:


and lastly when the player grabs the weapon the drawing of the line:

Where am I doing wrong? I can not understand the line always remains late

You’re centring the skin on playerhitbox, then changing the position of playerhitbox. Swap that around - position the playerhitbox, then place the skin. But that won’t make a difference.

Is the late drawing only when the player moves? And only if there is an enemy in the scene, or does that not make a difference?

The aiming raycast is at angle arma10.Direction(). What is that function, and where does it come from?

the line is delayed when the player is on the move and it makes no difference if there is an enemy in the scene or not.
The aiming raycast is at arma10 angle. Direction () was taken from the laserzombie example in the gdevelop library.

I have no idea what Direction() does or how it gets its value. It’s not documented anywhere, and it doesn’t come up in the Autocomplete when you start typing it in. In the example the laser is supposed to be to MouseX() and MouseY(), but it’s off by a bit.

Could you try using Arma10.Angle() instead? And could you get a screen shot or short gif/video of what is happening? My interpretation of what you are seeing may not be exactly what is happening.

I had also tried to modify in arma10.Angle but the problem remains.
does the exact same thing as the mini example I sent at the beginning of the post, which I managed to solve as you advised move, get values, raycast, draw.
if you want I can send a clip but it is the exact same problem the line follows late