10-06-2019, 07:21 PM
(10-06-2019, 04:14 PM)Richard Wrote: After that I should write code below to make handle?
Code:// Create the handle:
GameObject c = new GameObject("Obi Handle");
Undo.RegisterCreatedObjectUndo(c,"Create Obi Particle Handle");
ObiParticleHandle handle = c.AddComponent<ObiParticleHandle>();
handle.Actor = actor;
// Calculate position of handle from average of particle positions:
Vector3 average = Vector3.zero;
for(int i = 0; i < selectionStatus.Length; i++){
if (selectionStatus[i]){
average += wsPositions[i];
}
}
c.transform.position = average / selectedCount;
// Add the selected particles to the handle:
for(int i = 0; i < selectionStatus.Length; i++){
if (selectionStatus[i]){
handle.AddParticle(i,wsPositions[i],actor.invMasses[i]);
}
}
after you've determined which particles end up projected inside your marquee coordinates, then yes, you can make a handle out of them using the above code.