HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 

 SPARK Move a System?

Go down 

Messages : 11
Date d'inscription : 2011-10-12

PostSubject: SPARK Move a System?   Fri Oct 14, 2011 11:36 am


I want to move a SPARK System so the Effect, but my Problem is that if i try to Move the System it begins
from X Position Zero and Y Position Zero, but i have setted the X and Y Pos on 400, 300 as example and
in the Window the Effect dont moves...
So I think i have again a strange problem...

My Code:
   //Create Model
   SPK::Model *Model = SPK::Model::create(SPK::FLAG_RED | SPK::FLAG_GREEN | SPK::FLAG_BLUE | SPK::FLAG_ANGLE,
                                SPK::FLAG_RED  | SPK::FLAG_GREEN | SPK::FLAG_ANGLE);

   //Set Parameter
   Model->setParam(SPK::PARAM_RED,  0.0f, 0.0f);
   Model->setParam(SPK::PARAM_BLUE,  0.9f, 1.4f);
   Model->setParam(SPK::PARAM_GREEN, 0.2f, 0.6f);
   Model->setParam(SPK::PARAM_ALPHA, 0.8f, 0.0f);
   Model->setParam(SPK::PARAM_ANGLE, 0.0f, PI * 10.0f);

   //Set Lifetime
   Model->setLifeTime(5.0f, 7.0f);

   //Create our SFML Renderer
   SPK::SFML::SFMLPointRenderer* Renderer = SPK::SFML::SFMLPointRenderer::create(2.0f);

   //Zone where the Particles are
   SPK::Sphere *Point = SPK::Sphere::create(SPK::Vector3D(400.0f, 300.0f, 100.0f), 10.0f * PI);

   //The Emitter
   SPK::SphericEmitter *Emitter = SPK::SphericEmitter::create((SPK::Vector3D(0.0f, 0.0f, 100.0f), 0.0, 10.0f * PI));

   //Set Name

   //Set Force
   Emitter->setForce(3.2f, 3.2f);

   //Set Zone

   //Set Tank

   //Set Flow

   //Create a Group
   SPK::Group *Group = SPK::Group::create(Model, 15000);

   //Set Emitter for the Group

   //Set Renderer

   //Set Gravity
   Group->setGravity(SPK::Vector3D(0.0f, -1.0f, 0.0f));

   //Set Friction

   //Create SFML System
   SPK::SFML::SFMLSystem *System = SPK::SFML::SFMLSystem::create();

   //Add Group

   //Set Render Target

   //Set Shared

   //Set Z Factor

        //Couts 0 but i set 400
   cout << "X:" << System->GetPosition().x << endl;

         if(Event.Type == sf::Event::Closed)


         //Couts a wrong Position
         cout << "X: " << System->GetPosition().x << endl;

         //Moves, it moves, but it moves not really
                        //cant describe it..
         System->Move(100 * App.GetFrameTime(), 0);

      //Update System


I hope for help.. Smile
Back to top Go down
View user profile

Messages : 539
Date d'inscription : 2009-07-14
Age : 36

PostSubject: Re: SPARK Move a System?   Fri Oct 14, 2011 1:44 pm


there are 2 ways to spawn particles in SPARK : either local to the system or in the world

  • local : particles are moving as the system moves. They are emitted in the system space
  • world : particles are spawned in the world, once emitted they have their own life and dont care about the system's position. However, newly spawned particles used the system's position.

By default your in world mode. If you want to emit particles locally to the system, creates your system by passing false to the first parameter (worldTransformed)

Moreover if your using particle in a truly 2D environment, you can set the zFactor to 0

Regarding what outputs GetPosition which is not consistent with SetPosition, that's strange because its SFML code only.

Hope this helps
Back to top Go down
View user profile http://spark.developpez.com

Messages : 11
Date d'inscription : 2011-10-12

PostSubject: Re: SPARK Move a System?   Fri Oct 14, 2011 1:55 pm

Thank you very much!

You have solved my two problems, the other problem was that the Circle looks
so wide because the Z Factor was on 1 Razz

Thanks again! And thanks for this beautiful particle engine! cheers
Back to top Go down
View user profile
Sponsored content

PostSubject: Re: SPARK Move a System?   

Back to top Go down
SPARK Move a System?
Back to top 
Page 1 of 1
 Similar topics
» How to move my selenium test cases from Rc to Grid
» [ANSWERED] UDF File System?
» [ANSWERED] How to change the Logo at Control Panel -> System
» How to reformat and reinstall your Operating System
» Acer System Recovery Partition Hotkey & Instructions (eRecovery)

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Questions (en)-
Jump to: