Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
Objects 2 particles scripts not working!?

Objects 2 particles scripts not working!?

2005-04-23       - By brad

 Back
Reply:     1     2     3     4     5     6     7     8     9     10  

There's no pleasing some people! :-)

Here's a version that only works on clouds (since a point collection doesn't
have rotation data), and includes rotation and scale in the transform. I'm also
grabbing the size from the particle and setting the null size parameter. You
could use the particle size to set the null scale if you want:

function NullsOnCloud(inCloud)
{
  if(!inCloud) inCloud = selection(0);

  // Get global transform from inCloud
  var gTrans = inCloud.kinematics.global.transform;  
 
  // Get particle collection from inCloud
  var particles = inCloud.ActivePrimitive.particles;
 
  // For each particle, create a null and transform it to the point
  var rootNull = ActiveSceneRoot.AddNull('ParticleNulls');
  for(var i=0; i<particles.count; i++){
   
    var pTrans = XSIMath.CreateTransform();
   
    // Set local translation from particle
    var pos = particles(i).position;
    pTrans.SetTranslation(pos);
   
    // Set local rotation from particle
    var rot = particles(i).rotation;
    pTrans.SetRotationFromXYZAngles(rot);

    // Multiply local transform by global trans of cloud
    pTrans.MulInPlace(gTrans);
   
    // Create null and set global transform
    var node = rootNull.AddNull('particle' + i + 'Null');
    node.kinematics.global.transform = pTrans;
   
    // Set the size of the null from the particle size
    node.size.value = particles(i).size;
  }
}



-- ----Original Message-- ----
>  Thanks Brad! I will give it a spin. From looking through it, it doesn't
>  give me particle rotations though does it?
>
>
>  Morten
>
>
>  On Sat, 23 Apr 2005 18:14:14 +0000, "brad" <brad@(protected)> wrote :
>
>  > Below is a function that creates a null on each point of any input
>  object (poly, nurb, or cloud). It can be parsed and made into a command
>  button which will work on any selected object. It should be pretty easy to
>  hack if you need to replace the nulls with your own collection of objects:
>  >
>  > function NullsOnPoints(inObj)
>  > {
>  >   // If nothing input, use the selection
>  >   if(!inObj) inObj = selection(0);
>  >
>  >   // Get global transform from inObj
>  >   var gTrans = inObj.kinematics.global.transform;
>  >   var pTrans = XSIMath.CreateTransform();
>  >
>  >   // Get point collection from inObj
>  >   var points = inObj.ActivePrimitive.geometry.points;
>  >
>  >   // For each point, create a null and transform it to the point
>  >   var rootNull = ActiveSceneRoot.AddNull('PosNulls');
>  >   for(var i=0; i<points.count; i++){
>  >
>  >     // Get position vector of point
>  >     var pos = points(i).position;
>  >
>  >     // Multiply position by the global transform of the object
>  center
>  >     pos.MulByTransformationInPlace(gTrans);
>  >     pTrans.SetTranslation(pos);
>  >
>  >     // Create null and set global transform
>  >     var node = rootNull.AddNull('pnt' + i + 'Null');
>  >     node.kinematics.global.transform = pTrans;
>  >   }
>  > }
>  > // END FUNCTION -- ---- ---- ---- ---- ---- ---- ---- ---
>  >
>  >
>  > -Brad
>  > CG Soup
>  >
>  >
>  > -- ----Original Message-- ----
>  > >��I need to put objects on particles - not particle instances as I need
>  to
>  > >��see where objects intersect with a collision surface. I tried the
>  various
>  > >��scripts for attaching objects to particles, but they all fail :(
>  > >��
>  > >��I tried Olivier Lelardoux original one as well as the modified ones by
>  > >��Todd Akita and Eric Lampi. They fail with different messages and I
>  can't
>  > >��seem to get them to work, so I'm thinking maybe they don't work in
>  4.2!?
>  > >��
>  > >��I have tried all different combinations on picking sessions, but
>  still no
>  > >��go - has anyone tried and made one of these scripts work in 4.2 and
>  if so,
>  > >��could you give me a short do's and dont's list?
>  > >��
>  > >��TIA!
>  > >��
>  > >��
>  > >��--
>  > >��best regards
>  > >��
>  > >��Morten Bartholdy
>  > >��Colorshop VFX
>  > >��Denmark
>  > >��---
>  > >��Unsubscribe? Mail Majordomo@(protected) with the following text in
>  body:
>  > >��unsubscribe xsi
>  > -- ----Original Message-- ----
>  > ---
>  > Unsubscribe? Mail Majordomo@(protected) with the following text in
>  body:
>  > unsubscribe xsi
>  >
>  >
>  >
>
>  --
>  best regards
>
>  Morten Bartholdy
>  Colorshop VFX
>  Denmark
>
>  ---
>  Unsubscribe? Mail Majordomo@(protected) with the following text in body:
>  unsubscribe xsi
-- ----Original Message-- ----

---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi