  | | | Objects 2 particles scripts not working!? | Objects 2 particles scripts not working!? 2005-04-23 - By Morten Bartholdy
Back Thanks again Brad - that seems to want to do the trick.
Now I have little clue about scripting - from the syntax I am guessing this is jscript, so I gave it a .js extension, changed XSI scripting to jscript, selected the cloud and tried running it, but it doesn't really do anything in that case. How do I put it to use?
I really appreciate you taking the time Brad.
best Morten
On Sat, 23 Apr 2005 18:57:07 +0000, "brad" <brad@(protected)> wrote :
> 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 > > >
-- best regards
Morten Bartholdy Colorshop VFX Denmark
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |