Radial Shooting?

Hi Everyone,

This is my 1st post. 1st I wanna say im loving the unity engine, I’m creating a few games at the moment, just to try out a few different ways of working in the engine ^____^, hoping to port a few of these over to the IPhone once i get enough scripting in me.

Now I’ll move onto my problem, i can get enemies to appear, I can get enemies to die when I shoot them, but the enemy im trying to create shoots outwards, not in any specific direction, ie he shoots 20 bullets (there are all alpha planes…the same used multiple times) and they fire outward omni style, how Would I go about programming this in?

Hopefully this image I attached to the post should help clear up my rather horrid explanation, this is the only example I could find, be sure that mine wouldn’t be half as extreme as this…I just mean a single row of things encircling the character (if that makes sense).

My 1st thought (I’m not going to be back at home until tomorrow to try this out but this is only 50% of it anyway), is to manually place for example 20 objects around my enemy, and make a prefab from those,that sorts how to have the objects, as im confident I’d have to use a prefab for these anyway. But that doesnt solve how to fire them ouwards in all directions, firing in just +x is simple as is just +Y but how do i do plus AND minus x and plus AND minus y? And would this confuse unity completely?

My 2nd thought is to have the same object, multiply it several times, with each version rotated a little, this way when the enemy shoots in the y direction, due to the objects being rotated, their axis would be off, so the bottom one would shoot straight down and the left, right, etc ones would shoot straight down too, however due to them being rotated their “down” would actually be another direction I’m not sure if I’m explaining this very well at all actually).

Thanks all I can come up with, the 2nd idea seems the most likely idea outside of using particles, but particles are a little more cpu intensive, and I’d rather avoid them If I can.

I understand using planes with Alpha’s is often CPU intensive, I have shadows and all lighting completely turned off, so nothing is actually communicating with the alpha channel at all, and Im also not using pixel perfect collision, im just using simple primitives for collisions inside the solid part of the alpha.

I hope someone can help, even though im not at my PC right now, its irritating me as I cant seem to think of the best and least CPU intensive way of doing this.

Thanks

Dan[/url]

374645--12955--$images_176.jpeg

Hey guys, Still stuck on trying to figure this out.

Finally back at my own machine, trying to impliment the 2 Idea’s mentioned above but they dont Appear to work unfortunatly so im back to square one.

Please can someone provide a bit of help, i’d be very grateful.

Thanks

Dan

How do you have it programmed so far? Are you doing it in GUI code? Are these all objects existing in the Unity 3D world?

if the latter, does Transform.Translate() not work? Assuming they are all planes in a 3D world being rendered on an orthographic camera it should be as simple as.

yourElement.transform.Translate(x, y, z);

If you want to do it efficiently with a lot of objects, I suggest using something like iTween to handle the movement for you:

http://itween.pixelplacement.com/gettingstarted.php

Then you would just need starting an ending points for each path, and do a Coroutine to actually launch the projectiles at set intervals to get the line-of-elements you’re looking for. iTween would handle the “go from start to end over x seconds” for you.

I just added a new example that shows how you can create a gun turret with iTween. Maybe it could help you out with this?

Take a look here: iTween for Unity by Bob Berkebile (pixelplacement)