Use Particle Forces



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/11/2006 at 06:32, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Is there and easy way to incorporate all this forces into my own system?

    DeflectorObject
    GravitationObject
    RotationObject
    WindObject
    FrictionObject
    TurbulenceObject
    AttractorObject
    DestructorObject

    If no then it would be really helpful for any information how all this forces work internally to mimic it.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/11/2006 at 01:34, xxxxxxxx wrote:

    You can pass a dummy particle array to the particle modifiers.

    Basically you create the particle array like this:

      
    Particle *orig=(Particle* )GeAllocNC(sizeof(Particle)*pCount);       
    BaseParticle *sum=(BaseParticle* )GeAllocNC(sizeof(BaseParticle)*pCount);  
      
    if (!orig || !sum)  
    {  
         GeFree(orig);  
         GeFree(sum);  
         return;  
    }  
    

    fill the arrays and pass them to the particle modifiers

      
    if (op->GetInfo()&OBJECT;_PARTICLEMODIFIER)  
    {  
         ObjectData *od = (ObjectData* ) op->GetNodeData();  
         if (od) od->ModifyParticles((PluginObject* )op,orig,sum,pCount,tdiff);  
    }  
    

    hope this helps

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/11/2006 at 02:57, xxxxxxxx wrote:

    Thanks Matthias.
    Will look how well this will work, with my own particle system.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/11/2006 at 04:54, xxxxxxxx wrote:

    It should work. It works fine here with my particle system in DPIT so I assume it should work for you too.

    However, it seems these do not work:

    DeflectorObject
    DestructorObject

    At least my particles are not deflected at all. If you find out how to make these 2 work let me know.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/11/2006 at 12:54, xxxxxxxx wrote:

    DestructorObject only set bits of Particle to not alive.
    DeflectorObject do not work too for me.

    But I am not sure how all other are designed to work?

    BaseParticle::v is the new changed velocity and BaseParticle::count is the count of the modifier.

    So to get velocity back one need to do this ->

      
    particle.v = sum _.v / sum _.count;  
    

    Is this correct?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/11/2006 at 13:29, xxxxxxxx wrote:

    Ah! Thanks for the tip. I´ll check that bit state.

    And yes, that´s correct.

    (sum.v/sum.count)-orig.v3

    is the resulting force vector I use. :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/06/2011 at 07:03, xxxxxxxx wrote:

    Sorry to resurrect this old thread, but I've discovered why the Deflector modifier apparently doesn't work for third-party particle systems. I thought I'd pass this on in part return for the help I've been getting with my own particles.

    According to the SDK, when calling ModifyParticles, the array pp, which is an array of Particle objects, is "...used to read the particles information from and should not be modified.". Well, for all the the other modifiers, that's true, but it seems that Maxon's programmers ignored their own rule when programming the deflector.

    The deflector modifies the pp array directly instead of returning a changed velocity. So, to make the deflector object work, what you have to do is check to see if your particles's original v3 is the same as the pp array's v3 after the call to ModifyParticles. Normally it will be, because the other modifiers don't alter pp.v3 directly - they change the vector v in the array ss (this is using the SDK's variable names). If pp.v3 has been altered, just set your original v3 to that value and the deflector will work.

    For safety, I also check to make sure I'm dealing with a deflector object before changing my original v3.

    I hope this explanation makes sense - I can clarify with code if not :-)

    Steve


Log in to reply