Make particles move in a curve (like around a sphere)

Hi people I was wondering if any of you know how to make particle move around a sphere.
It doesn’t even have to take the sphere into consideration, maybe just the radius/diameter that you want.

I’ve already tried changing the parameters in the inspector but there is a lot of trial and error that goes into it and I’d have to change it every time I have a different size diameter/radius. Also since I’m emitting the particles from a moving object, that throws off the direction the particles are headed as well.

So what I’m looking for is a fast way (mobile) to have the particles translate along a diameter (I’ve seen it done for objects already)
but my scripting knowledge is not up to par with some of the great minds here, will anyone help?

Simulate the particles in local space and rotate the particle system itself, I think should do it.

I don’t want it to go in a spiral, I want them to translate around the surface of a sphere for example :

You will likely need to control the particle system manually using the Particle/ParticleSystem APIs. See the reference doco for examples.

If you have a specific question post back here and I’ll help if I can :slight_smile:

PS: You can see Vibre (sig) for an example of this, the whole game (minus menus and things) is written in the particle systems.

I found this interesting line of code:
particleEmitter.localVelocity

Which I can modify by setting it equal to a vector3 position
particleEmitter.localVelocity=new Vector3(pos,pos,pos);

So I guesss my question now is, what math functions can I use so that the particles move around in a sphere like path?

I’ll try experimenting with some Sin or Cos functions but I’m just shooting in the dark here.

EDIT: You think the equation for semi-circle would work? but then I don’t want velocity function, I want a position function. I’m digging up some more stuff.

Why not just have an empty object, place the particle emitter inside. Offset the particle emitter however much you want from the center. Ideally, it should be the radius of the desired sphere. Then, use iTween, roatateBy() to rotate the empty object as much as you want and in whatever direction you want, by which ever speed, for however long.

1 Like

The problem is that the stream of particle emitters IS the bullets.
I’m not launching individual particle emitters as bullets, I’m just using a stream-like laser that uses particle collider to send message that it has hit the enemy.

I do not see how that matters. If you need a particle emitters transform position to move in a way so that it rotates around a sphere, that is how I would do it. It would be quite easy to calculate any direct over time.

I have an emitter positioned at the front of a ship.
The particle emitter creates particles that move forward, pointing whatever direction the ship is pointing at.

The particles that it emits have to travel around the sphere, not the particle emitter itself.
Do you get it?

“the sphere” what is that?

Just like a planet or something, like what I posted on the third post.
So the partciles that are being emitted, I want them to travel around the sphere.
I do not want the particle emitter itself to travel around the sphere, because that stays with the ship. It’s like the “weapon”

Sounds like your ship should be shooting particle emitters, not particles. If that’s not what you want (ie, you want a single particle to move around) then just dump the particle emitter altogether, and move a game object around that uses the particle materials.

Yes, I see what you want, but I can’t see how particles could have such an affect. To control them, which sprout somewhat randomly in their settings (certainly controled) but still. I don’t see why you don’t just shoot an object with a particle emitter. Sorry, I just can’t see how it would work.

Is it just a numbers game? You want to use a particle emitter to have the effect of lots of bullets without the cost to memory?

Shooting of particle emitters sounds like a good solution, if it works for you then stick with it as its likely easier to manage. If its too expensive then you will may want to try the particles API as discussed.

You have complete control over individual particles if you want it. You can also combine manual control with particle system settings. In your case you would likely want to emit a burst of particles as a bullet. For each burst you track and update the position, calculating a delta each frame and then applying this delta to each particle in the “burst”. The rest of the particles attributes are controlled by the particle system.

A very rough sketch of the code:

int particlesPerBullet;
Vector3[bulletCount] deltaPos;

Update() {
// Update bullet pos and assign delta to deltaPos 
int currentBullet = 0;
// Get particles from system
for(int i =0; i < particles; i++) {
  particles[i].position += deltaPos[currentBullet];
  if (i % particlesPerBullet == 0) currentBullet++;
}
// Assign particles back to system
}

Exactly! Because I’m not shooting typical bullets here that are spaced. I want it to look like an even stream of plasma or something (like a thin flame thrower)

Interesting, I’ll see what I can pull out of this. Thanks.

         private Quaternion rotation;
	private Vector3 radius = new Vector3(25,0,0);
	
	void LateUpdate () {
		

    	Particle[] particles = particleEmitter.particles;
    	for (int i = 0; i < particles.Length; i++) {
		
			rotation.eulerAngles += new Vector3(0, (1)*Time.deltaTime, 0);
        	particles[i].position =rotation * radius;

    	}
    	particleEmitter.particles = particles;
	}

This is what I’ve cooked up so far.
The particles do go around in a circle (hurray!) but it’s no longer a stream, it’s as if they are all bunched up into one.
Also it doesn’t take my ship’s rotation into account so it’s always just translating around in one direction.

Help!

I am not sure if this is helpful as I haven’t mastered the function yet, but sure it will work for my needs…

I have a flame thrower.
It contains a dozen triggers, lined out next to each other along an axis.
The triggers are chilled to the weapon.
When weapon shoots projectile, and enters a trigger, that trigger enables its flame.renderer.
When the projectile exits it disables the renderer.

On a side note, I can adjust the position of the flame to the position of the bullet. Each triggers flame is set to a progressively larger scale creating a flamethrower effect.

Very interesting concept.
I might use it as a last resort since I will have to reposition every trigger for a different radius planet. Which can be a pain in the ass

Yah,
its is a bit finnicky. I am lucky that my flame thrower is small scale.

what game if your example from?