0

when i shoot bullets with offset(when shooting the bullet would spawn as if the gun is straigh forward even if I have lets say aimed it upwards)

the gun origin point

the offset doesnt take gun rotation into the account.

The video of the problem: https://i.stack.imgur.com/Ur24u.jpg.

Heres the gun/shooting code:

x = oPlayer.x + 30;
y = oPlayer.y;

image_angle=point_direction(x,y,mouse_x,mouse_y);

firerate -= 1;
if mouse_check_button_pressed(mb_left)
{
    with(instance_create_layer(x + lengthdir_x(50,image_angle) ,y ,"Bullets",oBullet))
    {
        speed = 20;
        direction = other.image_angle;
        image_angle = direction;
    }

}         

Thanks in advance!

[SOLUTION]

edit: after 3 more hours of search I found the solution:

Spawn bullet at barrel of gun

Kweezo
  • 3
  • 3
  • If you found a solution, please post that as an answer and mark it as accepted. That way it'll also be registered as an answerred question. even if you found the solution yourself. :) – Steven Oct 02 '20 at 10:10
  • Does this answer your question? [Spawn bullet at barrel of gun](https://stackoverflow.com/questions/26308138/spawn-bullet-at-barrel-of-gun) – Steven Oct 02 '20 at 10:11

0 Answers0