About Store Forum Documentation Contact
Donations:
206$/mo



Post Reply 
Particles as sub objects
Author Message
b1s Offline
Member

Post: #1
Particles as sub objects
im trying to create particles as sub object.
first it tried it like it was on the lights tutorial.. didnt have any luck.
I guess something was created but nothing visible.
Code:
// add custom children
   for(Game::ObjParams *cur=&obj; cur; cur=cur->base()) // check 'obj' and all its bases
      FREPA(cur->sub_obj) // for each sub-object in 'cur'
      {
         Game::ObjParams &o=cur->sub_obj[i];

         switch(Game::World.objType(o.type())) // check the type of sub-object
         {
         case OBJ_PARTICLES: // if there are particles involved.
             particles.create(o);
          break;
         }
      }


Secondly i tried according to "Create multiple Phys objs in ME" thread something like this:
No luck here either.
Do i have to draw something or whats the deal when trying to add particles as sub objects?
Code:
for(Game::ObjParams *cur=&obj; cur; cur=cur->base()) // check 'obj' and all its bases
      FREPA(cur->sub_obj) // for each sub-object in 'cur'
      {
         __super::create(cur->sub_obj[i]);
      }
(This post was last modified: 04-11-2010 12:09 PM by b1s.)
04-11-2010 12:08 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Particles as sub objects
1st code is ok (2nd is not)

but you still need to 'update' and 'draw' the 'particles' object
04-11-2010 12:22 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
RE: Particles as sub objects
im getting quite confused with the drawing.
im trying to call particles.drawPrepare(); inside drawPrepare of the item
and update from the items update.
i guess this is somehow wrong also.
could you elaborate about the drawing calls.. what are the methods that i should call exactly and where?
04-11-2010 04:31 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Particles as sub objects
oh, I've looked more into your code.
1st method you should use 'Particles' class instead of 'Game::ObjParticles'
the rest should be easy as you've got a tutorial for particles.
04-11-2010 06:31 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #5
RE: Particles as sub objects
hmm.. what im looking to do here is to add an already saved .obj particle effect to an item object. the particle tutorials seem to teach how to create a manual particle effects.
or am i missing something? isint it possible to add an object to a another object and it would just use the parents matrix and behave otherwise as a normal world editor particle effect.

So.. i only want the easiest way to add a particle effect to world and that its attached to an object.
(This post was last modified: 04-11-2010 07:53 PM by b1s.)
04-11-2010 07:49 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Particles as sub objects
Particles p;

create:
p.create(Particles("..path.."));


update:
p.update(..

draw:
p.draw(..
04-11-2010 09:19 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #7
RE: Particles as sub objects
hmm ok thanks
04-11-2010 10:35 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #8
RE: Particles as sub objects
i don't understand why this has to be this hard.
Cant it just create it automatically in world.init() ?
Isn't it just an object that uses the parent objects matrix?

well i guess this is not too hard.. im still a bit confused about the draw calls.
I guess i shouldn't call the p.draw() inside drawPrepare()?
Would the correct thing to do be that i create a draw() for items and call them in the main draw loop? also i probably will have to check in which mode they should be called?
Code:
    // add custom children
    for(Game::ObjParams *cur=&obj; cur; cur=cur->base()) // check 'obj' and all its bases
      FREPA(cur->sub_obj) // for each sub-object in 'cur'
      {

            Game::ObjParams &objs=cur->sub_obj[i]; // get object
            Game::World.objCreate(objs,Matrix(obj.scale(),obj.matrix.pos));    
            
    
      }

This seems to create it to the correct position and matrix.
Only thing is now that i need a way to point to that object so i can update its position.
(This post was last modified: 04-12-2010 09:23 AM by b1s.)
04-12-2010 08:45 AM
Find all posts by this user Quote this message in a reply
Post Reply