2 Replies - 265 Views - Last Post: 16 June 2019 - 03:47 PM Rate Topic: -----

#1 eMonolith   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-June 19

particles don't emit in 360 degrees from center.

Posted 15 June 2019 - 10:00 PM

My particles emit from center from 0 - 360, but particles are only emitted every 45 degrees and not every degree around center.


 Uint8 *keystate = SDL_GetKeyState(NULL); 
	// Mouse position
	int pax = SCREEN_WIDTH / 2;	// int mousex;  //center of screen/ATTRACTION_POWER
	int pay = SCREEN_HEIGHT / 2;	// int mousey;

	// state = SDL_GetMouseState (&mousex, &mousey);

	// left mouse button pressed
	if (keystate[SDLK_RETURN]) //if (state & SDL_BUTTON(1))
	{
		// spawn particles
		for (int i = 0; i < SPAWN_RATE; i++)
		for (int p = 0; p < 360; p++)		//360 //720 //1000 ? //1080 //1440  //density of emitted circular particle emittions
		{
			// loop back to first particle if too many are spawned
			if (respawn == PARTICLE_COUNT)
			{
				respawn = 0; //respawn = 0;
			}

			// spawn the particle at its position
			double direction = (p);//(2*M_PI*p);//this works and now I realize that the emitter is square with low values of p //TODO make the emitter a circle

			//double direction = (sin((p*3.14) / 360));//this and variations don't work, just sprays in a sin waveform to the right
		//double direction = (p*3.14);
                        //double direction = (part[i].getAngle() + 10 %360);  //test for full linear rotation 

			// change direction to x and y velocity
			double xvel = cosd(direction) * (particleSpeed);  //  double xvel = particleSpeed * cosd(direction);  //  x1 = r * cos(angle * PI / 180);
			double yvel = sind(direction) * (particleSpeed);  //  double yvel = particleSpeed * sind(direction);  //  y1 = r * sin(angle * PI / 180);
			// actually create particle
//part[respawn].respawnParticle(mousex, mousey, xvel, yvel);
 part[respawn].respawnParticle(pax, pay, xvel, yvel); 

			// go to next particle
			respawn++;
		}
	}




Is This A Good Question/Topic? 0
  • +

Replies To: particles don't emit in 360 degrees from center.

#2 eMonolith   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-June 19

Re: particles don't emit in 360 degrees from center.

Posted 15 June 2019 - 11:05 PM

I can't be sure my simulator is working right.
Was This Post Helpful? 0
  • +
  • -

#3 eMonolith   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-June 19

Re: particles don't emit in 360 degrees from center.

Posted 16 June 2019 - 03:47 PM

I have more code in fact a nice simulator that still needs work, but I'd like help with this one problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1