|Topic was automatically imported from the old Question2Answer platform.
Hi there, and thanks for taking the time to read (and hopefully answer) this question. I have a very simple project, consisting of only a player, a gun, and a tile set. The gun is capable of shooting bullets, I have that part working fine. My problem isn’t with the gun, but with the bullets. The gun always points towards the mouse, and its position and rotation is stored so that the bullets that are shot out of it are orientated correctly. This works fine when the bullets are shot in a straight line without gravity, but after I added gravity it looks a little wonky because it doesn’t rotate around the center of mass like a normal projectile would. For context on how I want it to look, think of like a badminton shuttlecock, where it rotates around the center of mass. This is probably due to the fact that I set the initial rotation of the object in a start function:
func start(pos, dir):
rotation = dir #dir and pos are variables that reference the rotation and
position = pos #position of the gun.
velocity = Vector2(speed, 0).rotated(rotation)
That’s really all there is. Conceptually it’s probably really easy, but since I’m still fairly new to GDscript I can’t seem to figure it out for the life of me. Any and all help will be much appreciated!