Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
Hello. I'm currently trying to attach clothes on specific point of body(actor's local space) using obi particle attachment(cloth) pin constraint setting(body). I know I can make cloth stop falling from body using particle attachment with dynamic type and compliance value, but is there any way to attach cloth on specific position of actor's local space and edit the position in inspector or in editor with given value? Thank you
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
30-08-2024, 07:54 AM
(This post was last modified: 30-08-2024, 07:55 AM by josemendez.)
(30-08-2024, 07:37 AM)gahyun11 Wrote: Hello. I'm currently trying to attach clothes on specific point of body(actor's local space) using obi particle attachment(cloth) pin constraint setting(body). I know I can make cloth stop falling from body using particle attachment with dynamic type and compliance value, but is there any way to attach cloth on specific position of actor's local space and edit the position in inspector or in editor with given value? Thank you
Hi,
This is the default behavior of ObiParticleAttachments: when enabled, they'll attach the particle(s) at their current position relative to the target transform. You can just move the cloth and/or the target around to change the attachment position.
If you need to force *only* the attached particles to move to a specific position before enabling the attachment, you can also do so (even though it will stretch the cloth and cause it to "jump" during the first few frames of simulation, which is pretty much always an undesired effect). The manual contains sample code for a component that will force the particles to move to the target transform's local origin: http://obi.virtualmethodstudio.com/manua...ments.html
kind regards,
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
03-09-2024, 08:55 AM
(This post was last modified: 03-09-2024, 08:57 AM by gahyun11.
Edit Reason: grammar issue
)
(30-08-2024, 07:54 AM)josemendez Wrote: Hi,
This is the default behavior of ObiParticleAttachments: when enabled, they'll attach the particle(s) at their current position relative to the target transform. You can just move the cloth and/or the target around to change the attachment position.
If you need to force *only* the attached particles to move to a specific position before enabling the attachment, you can also do so (even though it will stretch the cloth and cause it to "jump" during the first few frames of simulation, which is pretty much always an undesired effect). The manual contains sample code for a component that will force the particles to move to the target transform's local origin: http://obi.virtualmethodstudio.com/manua...ments.html
kind regards,
Thank you for explanation! And, can I ask you one more thing? We currently have to generate obi distance field in every 1st time the player starts to play via scripts. But obidistancefield.generate() is pretty slow with the condtion that we set - max depth =7, max error =(1e-05). I know this is pretty picky and heavy to any platform to generate distance field , but we do really need this condition for this project. Is there any way to make this generate coroutine more faster?
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
03-09-2024, 09:04 AM
(This post was last modified: 03-09-2024, 09:05 AM by josemendez.)
(03-09-2024, 08:55 AM)gahyun11 Wrote:
Thank you for explanation! And, can I ask you one more thing? We currently have to generate obi distance field in every 1st time the player starts to play via scripts. But obidistancefield.generate() is pretty slow with the condtion that we set - max depth =7, max error =(1e-05). I know this is pretty picky and heavy to any platform to generate distance field , but we do really need this condition for this project. Is there any way to make this generate coroutine more faster?
Hi,
The current implementation of ObiDistanceField.Generate() cannot be made any faster. To get any significant performance improvement would require rewriting it from scratch, possibly using a multithreaded method or a GPU implementation. This is not high priority in our roadmap, as distance field generation is primarily used in the editor in most cases.
kind regards,
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
(03-09-2024, 09:04 AM)josemendez Wrote: Hi,
The current implementation of ObiDistanceField.Generate() cannot be made any faster. To get any significant performance improvement would require rewriting it from scratch, possibly using a multithreaded method or a GPU implementation. This is not high priority in our roadmap, as distance field generation is primarily used in the editor in most cases.
kind regards, Hi. Considering your advice, I edit my code from max depth=7 to max depth=6. It still shows good quality as much as distance field with max depth 7. And about particle attachment, I'm trying to set particle group from none to dynamic in obi particle attachment of clothes asset, but I cant find how to do this in script. Can you teach me?
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
05-09-2024, 08:20 AM
(This post was last modified: 05-09-2024, 08:20 AM by josemendez.)
(05-09-2024, 04:47 AM)gahyun11 Wrote: Hi. Considering your advice, I edit my code from max depth=7 to max depth=6. It still shows good quality as much as distance field with max depth 7. And about particle attachment, I'm trying to set particle group from none to dynamic in obi particle attachment of clothes asset, but I cant find how to do this in script. Can you teach me?
Hi,
About setting the attachment's particle group at runtime, see: http://obi.virtualmethodstudio.com/manua...ments.html
kind regards
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
(05-09-2024, 08:20 AM)josemendez Wrote: Hi,
About setting the attachment's particle group at runtime, see: http://obi.virtualmethodstudio.com/manua...ments.html
kind regards Hello. Thank you for giving the link but I already read the document and adapted attachment.particleGroup = actor.blueprint.groups[0] part into my script like below
Code: obiSkinnedCloth.GetComponent<ObiParticleAttachment>().particleGroup = communicate._obiSolver.actors[0].blueprint.groups[0];
All cloth assets blueprints that we have have no particle groups, same as body asset blueprints. But the weird issue that i have is some of the clothes work well with the code beyond, but some of the cloth blueprints dont work with the code. Except setting particle groups, other parts of particle attachment components work well- attachment type and compliance. I only tried editing this 3 parts - particle group, attachment type, compliance.
I just tried this one and it didnt work well again. Please let me know if I miss something. The '_obiSolver' gameobject is the body gameobject .
Code: obiSkinnedCloth.GetComponent<ObiParticleAttachment>().particleGroup = communicate._obiSolver.GetComponent<ObiActor>().blueprint.groups[0];
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
06-09-2024, 10:32 AM
(This post was last modified: 06-09-2024, 10:44 AM by josemendez.)
(06-09-2024, 09:30 AM)gahyun11 Wrote: Code: obiSkinnedCloth.GetComponent<ObiParticleAttachment>().particleGroup = communicate._obiSolver.actors[0].blueprint.groups[0];
All cloth assets blueprints that we have have no particle groups, same as body asset blueprints.
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];
(06-09-2024, 09:30 AM)gahyun11 Wrote: I just tried this one and it didnt work well again. Please let me know if I miss something. The '_obiSolver' gameobject is the body gameobject .
Code:
obiSkinnedCloth.GetComponent<ObiParticleAttachment>().particleGroup = communicate._obiSolver.GetComponent<ObiActor>().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,
Posts: 21
Threads: 3
Joined: Aug 2024
Reputation:
0
(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.
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
06-09-2024, 11:09 AM
(This post was last modified: 06-09-2024, 12:15 PM by josemendez.)
(06-09-2024, 10:56 AM)gahyun11 Wrote: 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".
Hi!
I believe you may be confusing particle groups with collision filters?. There's no way the attachment's particle group parameter can show "All" unless you have a particle group that has specifically been named "All". However the collides with parameter of a collision filter will show "All" when it can collide with all collision categories, which is the default setting.
(06-09-2024, 10:56 AM)gahyun11 Wrote: 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?
As explained above, it's not possible for particle attachments to show "None" or "All" in their particle group dropdown. This is what collision filters do, however.
In their inspector, attachments show the names of the particle groups that exist in the blueprint being used by the cloth or softbody: so if your blueprint has no particle groups, it won't show anything. If your blueprint does have particle groups, the dropdown will show their names so that you can choose one.
When assigning groups programmatically, the same logic applies: if your blueprint has no particle groups, you can't assign one to the attachment. In other words: Particle groups define which parts of the cloth/softbody you want to attach to another object, you can't attach the object if you don't specify which parts should be attached.
(06-09-2024, 10:56 AM)gahyun11 Wrote: 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.
That's fine! you should not skip sleep though, that's bad for your health - and also your mental state. I was just pointing out that the code you wrote couldn't possibly work, but we have all been there at times. Let me know if you need further help!
kind regards
|