Creating instances of an object.



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

    On 10/04/2010 at 20:36, xxxxxxxx wrote:

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

    ---------
    Hey everyone.

    I have created a particle generator that uses draw() to create visual representations of the particles.  I would now like to attach instances of an object to each particle.  Would I do this with bd-DrawObject()    and if so,  how would I then update the position of each drawn object.  -or-  would  I need to create the objects in GetVirtualObjects.    if so how would I go about doing this?   Thanks for your time.

    ~Shawn



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

    On 10/04/2010 at 21:58, xxxxxxxx wrote:

    Well, if you would like to add real stuff in the scene, you must use GetVirtualObjects. You find an example in the SDK - atom.cpp or similarily named.

    Kabe



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

    On 11/04/2010 at 04:29, xxxxxxxx wrote:

    If you just want a visual representation in the editor (like the standard particles and TP also have), you can do that in Draw(). To create real geometry that can be rendered, you have to use GetVirtualObjects(), as Kabe said.
    How you update those positions is up to you. I guess you have an array with all particle positions stored somewhere in you class, so you can simply use that.
    Cheers,
    Jack



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

    On 19/04/2010 at 11:20, xxxxxxxx wrote:

    Okay..  so given this information,  If I want to display textured polygons as my particles,  I would create a polygon in GetVirtualObjects,  and then call GetVirtualObjects() is passed a hierarchyhelp..  I will need to define one in my particle update() function..    could someone tell me how to do that?

    Thanks,

    PS this is what I have in GetVirtualObjects() to create the polygon.

      
      
      PolygonObject *polyObj = PolygonObject::Alloc(4,1);  
      if (!polyObj) goto Error;  
      
      Vector *padr=NULL;  
      
      CPolygon *vadr=NULL;  
      
      padr = polyObj->GetPointW();  
      
      vadr = polyObj->GetPolygonW();  
      
      padr[0] = Vector(0,-100,-100);  
      padr[1] = Vector(0,-100,100);  
      padr[2] = Vector(0,100,100);  
      padr[3] = Vector(0,100,-100);  
      
      vadr[0] = CPolygon(0,1,2,3);  
      
      return polyObj;  
      
    Error:  
      
      return NULL;  
      
    

    ~Shawn


Log in to reply