There you go. This is JScript. Just select a bunch of objects and you
get a particle cloud which you can drive with any forces. Currently
the script only transfers the objects' positions to the particles, not
their rotations (yep, I have been lazy). In other words, if your
objects have rotation applied, the particles will reset them to 0/0/0,
so do a freeze rotation beforehand if this applies to your scene.
If you want to combine this with RBDs, you can make the objects
passive RBDs and simply switch them to active at any time you like,
the RBD engine will instantly take over and make the objects leave
their particle trails.
Hope that helps, cheers!
-André
Morten Bartholdy wrote:
It sounds good André - I also need to do a load of smaller pieces of
concrete and was just looking into ways to do that on top of my large
piece simulation. I would be hvery grateful if you would pass me that
script. Thanks a lot!
Cheers
Morten Bartholdy
3D & VFX Artist
----- Original Message ----- From: "André Adam" <a_adam(at)49games.de>
To: <XSI(at)Softimage.COM>
Sent: Wednesday, June 27, 2007 5:59 PM
Subject: Re: A couple of RBD questions
I've just done something like this using a combination of scripting,
particles and RBDs. Basically I sketched a particle cloud, one
particle for each object, created a particle cloud with simulation
props from the sketched cloud, then created a cluster constraint
from each object to its corresponding particle and finally used this
setup to shoot the rocks out of the wall using the particle system.
As soon as the rocks did not sit on top of each other anymore I
switched the rocks' RBD properties from passive to active and let
the RBD engine do the floor collisions. Worked out nicely, with a
script creating the particle setup from the selected rocks in one go.
If this workflow would be of help for you I could provide you with
the script to do the setup.
Cheers!
-André
Morten Bartholdy wrote:
I am breaking a wall with RBD and am using a set of pieces which
are slightly smaller then the ones I want to render so I can avoid
interpenetration in the beginnnig of the simulation. Now I know I
can transfer the cache to a clip in the mixer, but if I want to
copy this motion to each renderpiece or constrain these to the
RBD'ed pieces it starts looking a bit complicated. If I create a
cluster with center my RBD is shot. Next thing I would try is to
multi point constrain my renderpiece to the RBD piece but this
requires me to create three clusters on each RBD piece and then
three point constrain each renderpiece to those. Please tell me
Softimage thought of easier ways to handle something like this with
up towards 100 separate RBD pieces???
Another thing is my pieces tend to explode a bit away from each
other even though I have made absolutely sure there are no
interpenetrations at the bewginning of the sim. I have increased
simulation and collision acuracy to very high levels without quite
getting rid of this behaviour. Also I have elasticity all the way
down to 0.001 since these are supposed to look like concrete
pieces, but I still get weird styrofoam like bounce and
sploinng-like fly away behaviour from the odd piece when it
collides with something again after landing on the ground. I have
tried messing with friction parameters without much luck.
I am guessing there a tips and tricks I still need to learn about
the wonderful world of RBD'ing so if someone knows a way to dampen
simulation collisions I would be happy to hear them, if someone in
the know cares to share some insight.
Thanks!
Morten Bartholdy
3D & VFX Artist
------------------------------------------------------------------------
/*========================================================
"Selection To Particles" / André Adam
Constrains a selection of objects to a newly created particle cloud.
Resets the objects rotation in the current implementation!
========================================================*/
//Create a particle type for later use
var oPTypeRtn = CreateParticleType(siBillboardType);
var oPType = oPTypeRtn.Value("Output");
//Create an empty particle cloud and get its primitive
var oCloud = ActiveSceneRoot.AddParticleCloud(oPType, "Sketched Particles");
var oPrimitive = oCloud.ActivePrimitive;
//Copy the selection into a new collection to avoid trouble with selection changes
var cSel = Selection;
var cCopySel = new ActiveXObject("XSI.Collection");
cCopySel.AddItems(cSel);
//Create an empty array and fill it with position data from selected objects
var aPos = new Array();
for(var i=0; i<cCopySel.Count; i++){
aPos.push(cCopySel(i).Kinematics.Global.Transform.PosX);
aPos.push(cCopySel(i).Kinematics.Global.Transform.PosY);
aPos.push(cCopySel(i).Kinematics.Global.Transform.PosZ);
}
//Create particles in the cloud
oPrimitive.AddParticles(cCopySel.Count, oPType);
//Position particles in the cloud
oPrimitive.Particles.PositionArray = aPos;
//Create a new cloud using the old one as an initial state; the new cloud owns simulation properties
var oInitialStateCloud = CreateParticleCloud(oCloud)(0);
oInitialStateCloud.Name = "Simulation Particles";
//Make particles live forever
oCloud.Properties("Initial State Property").Parameters("liveforever").Value = true;
//Create clusters from the new cloud's particles and constrain the former selected objects to them
var oGeo = oInitialStateCloud.ActivePrimitive.Geometry;
for(i=0; i<cCopySel.Count; i++){
//Create cluster
var oCluster = oGeo.AddCluster(siVertexCluster, cCopySel(i).Name, (i));
//Create constraint and set tangent and upvectors
var oConstraint = cCopySel(i).Kinematics.AddConstraint("ObjectToCluster", oCluster);
oConstraint.Parameters("tangent").Value = true;
oConstraint.Parameters("dirx").Value = 0;
oConstraint.Parameters("diry").Value = 0;
oConstraint.Parameters("dirz").Value = 1;
oConstraint.Parameters("upvct_active").Value = true;
oConstraint.Parameters("upx").Value = 1;
oConstraint.Parameters("upy").Value = 0;
oConstraint.Parameters("upz").Value = 0;
}