![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Craft Game |
im trying to make a gun that shoots in a direction of the gun’s rotation, how do i do that?
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Craft Game |
im trying to make a gun that shoots in a direction of the gun’s rotation, how do i do that?
![]() |
Reply From: | magicalogic |
Get the guns rotation and apply it to the bullets rotation.
Something like
bullet.rotation = gun.rotation
Another thing, the bullet should not be a child of the gun. It should be a child of the level itself so if you instanciate it at the gun scene make sure you declare it as so.
get_parent().add_child(bullet)
yeah but, for example, if im aiming down, the gun have to shoot down, if im aiming up, the gun have to shoot up
Craft Game | 2021-06-16 23:01
Add a position2d node in your gun Scene at the end of the muzzle and when you create your bullets make their global position to be there.
magicalogic | 2021-06-17 04:39