Siguiendo con el tema inicial, quería apilar o hacer una montaña de bolas. Como la idea inicial era usar un emisor de particulas, con ello el número de instancias de cada bola lo generaba el programa.
Ahora, siguiendo por el camino que Sumatra dijo (usar solo dinamicas), la generación de bolas solo se me ocurre hacerla clonando el objeto, lo que hace que haya un número estático de bolas.
A alguien se le ocurre cómo hacer algo más parecido al emisor de particulas para la generación de las bolas?
Se me olvida decir, que tendré al menos tres tipos de bolas o pelotas diferentes. Estoy pensando en meterlas en un modelo y hacer instancias, o en un grupo y ver si se puede clonar el grupo.
Fijate si esto te sirve, no lo probe nunca. Sacado de XSIBASE.
>>>>>>>
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é
-
/*========================================================
"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;
}