06-09-2024, 10:56 AM
(06-09-2024, 10:32 AM)josemendez Wrote: Hi,
If your blueprints have no particle groups, how can you expect the above code to work? this code assigns the first particle group to the attachment, if there's no groups in the blueprint this will throw an index out of bounds exception. You can't attach a cloth with no particle groups: it stands to reason that you must have at least one group of particles to attach. Maybe I'm misunderstanding your goal?
Furthermore your code assigns a particle group belonging to an actor that may not be the one being attached, which of course won't work: there's no guarantee the first registered actor in your solver is the same cloth whose attachment you're modifying. Correct code would be:
Code:obiSkinnedCloth.GetComponent<ObiParticleAttachment>().particleGroup = obiSkinnedCloth.blueprint.groups[0];
or, depending on your particular use case:
Code:communicate._obiSolver.actors[0].GetComponent<ObiParticleAttachment>().particleGroup = communicate._obiSolver.actors[0].blueprint.groups[0];
This code doesn't make any sense: you're attempting to retrieve an actor component from the solver gameobject, which will throw a null reference exception since the solver does not have such a component. Make sure you understand GameObjects and Components clearly, it's pretty important to familiarize yourself with the basics first.
kind regards,
Hello. Thank you for explanation. Now I can understand more. The reason why I thought I can set particle groups of cloth particle attachment component, as soon as I set target to body gameobject which has mesh collider of the body fpx mesh, and obi collider, in the cloth gameobject that has obi skinnedcloth, obi skined cloth renderer, through the code, some of the cloth asset objects(Like I mentioned, none of them and body blueprint do have particles in thier blueprint but they dont hav any particle groups) automatically get particle group from none to "All".
If I understand clear, both cloth and body have no particle groups in their blueprint, cloth asset gameobject's obi particle attachment has no change between setting particcle group with "none" and "all" even if I set target of the cloth to body? Sorry, I know I need to learn well, I just started to learn your guys plugin about a month ago, and sleepy all days cause of this issue, so i believe my writings def can be looked so messy. wish you understand this.