bullets need to fly in a spiral (bullets on a path?)

hi al!

i got a gun shooting some bullets! :slight_smile:
but i want them to fly in a spiral when i shoot them! :slight_smile:

something as this:
http://davidebenini.it/wp-content/uploads/2008/05/spiral-1.jpg

can i make a path or something? or is it possible?

thanks!

May I ask why?

Why not just use spiral mathematical function? What i mean, write it in python, it really shouldnt be that hard…

i can’t write python :frowning: so i don’t know how i have to do that!
and why: yes that is a good question, i’m making a kind of space game! :slight_smile: and i want my bullets fly in spirals! :slight_smile:

Python is very easy to learn, as programming languages go. Learn python!

Just move the bullet along one of it’s local axis while rotating it around a perpendicular axis by an increasing variable. For example, move the bullet along the x-axis at a set speed, give the bullet a radius property set at zero. Each time the bullet is moved along the x-axis, rotate it along the z-axis by the amount defined in the radius property. This will make the bullet move in a circle, gradually increasing the radius property will cause the bullet to rotate on the z-axis faster, which will result in smaller circles. Simply add some logic to test if the radius property has reached/passed a set value, if it has, destroy the bullet.

Quick Attempt:


cont = GameLogic.getCurrentController() 
bullet = cont.owner 
 
bullet["radius"] += 0.005 
maxRad = bullet["maxRad"] 
 
actMove = cont.actuators["Move"] 
actMove.dRot = [0.0, 0.0, bullet["radius"]] 
cont.activate(actMove) 
 
if bullet["radius"] >= maxRad: 
    bullet.endObject()

Attachments

spiral.blend (137 KB)

Wouldn’t it work simply to have the bullet move forward and while rotating to an angle slightly? I may be mistaken, but I think it might work.

Or you could just have the object center offset, so you could add a constant rotation and that would make a spiral.

Just for clarification, do you want it to spiral, or corkscrew- IE do you want it to increase the radius of its rotation, or move as though it were going around a tube?

Corkscrewing is simple- parent the bullet to an empty, and have the empty move forward and spin around its forward axis, so the bullet orbits around it. I don’t recommend having the bullet object’s center offset, to ensure collision works right. Spiraling could be done by doing the same thing, only also having the bullet move away from the empty at a constant rate.

Just move the bullet outward from the origin. Then, use the ipo curve editor to extend rotation on the axis that makes your bullet spiral, like the y axis.

Really easy way to do it, make an empty that fires the bullets, and make it slightly rotated on the x axis, then make an ipo that makes it always rotate around the y axis.

Or do you want a cylindrical spiral? In that case, just use two empties.

Here is an example of both.

Attachments

Spiral gun.blend (154 KB)

its more like hendore made it, but the bullets are going in the wrong direction! :slight_smile:
i made a little photoshop:

http://i29.tinypic.com/2wcgzk0.gif

you see?! thats what i want! :slight_smile:
thanks guys that you want to help me!
e.m.

you would need a initial offset, or the bullet would always fly like:
center-left-center-left, instead of
left-right-left-right

Right here!!!

Attachments

SPIRAL.blend (184 KB)

mm nice! but how do i do that?!
i already have a shooting gun? how can i change that?

well give me the gun and i will make all the set up!

here it is! when you open it, you will see the space ship in a maze!
in the space ship you will see the gun! :slight_smile:
the bullet is in layer 2 :slight_smile:
file…

and how sholud i modify your file if autostart is on?>

oeps! here is he again! :slight_smile:

http://www.filedropper.com/wotan-movement-in-maze_1

is it working??