Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Can I attach particeattachment in script?
#25
(21-10-2024, 09:53 AM)gahyun11 Wrote: I'm sorry but where can I find that? I keep looking skinned cloth blueprint of both clothings and its obiskinnedcloth component but cant find any "one-sided" colliision. I see "Self collisions" on Obi skinned Cloth component but this is not what you are talking about, isnt it? I'm currently using obi 6.5.4 cause we need time to convert all clothings' skinnedclothblueprint from 6.5.4 to version 7.

Code:
cloth.oneSided = true;

This allows particles to only collide with the side their normal vector is pointing towards. So if another particle tries to collide with its backside, it will be projected to the front.

See the "OneSidedCollisions" sample scene.

(21-10-2024, 09:53 AM)gahyun11 Wrote: We aren't trying to do this work in runtime anymore. We wanna edit clothing assets' blueprints now through script. 

In that case, you need to access the blueprint's constraint data. (blueprint.distanceConstraintsData, skinConstraintsData, and so on). These contain constraint batches, that are accessed an modified just like they are at runtime. The only difference is that these are stored in the blueprint, instead of the solver.

(21-10-2024, 09:53 AM)gahyun11 Wrote: I read both of documents already and found out invMasses property in obi blueprint has inverse value of mass of each particle but I wasn't sure. I know I can use this but just wonder if I have to calculate inverse value of the invMasses to figure out original mass value every time?

Yes, invMass is just 1/mass. You can convert between them anytime you need. Be careful with division by zero.

The reason Obi uses inverse mass internally is to avoid having to perform a division thousands of times every single frame during simulation, so using inverse mass is considerably more efficient.

(21-10-2024, 09:53 AM)gahyun11 Wrote: And I also wonder how can i find index of particles in specific particle group, not index of the particle group, index of the particleIndice, so I can edit property value in script

Code:
group.particleIndices

Please check the API docs.

(21-10-2024, 09:53 AM)gahyun11 Wrote: Hmmm. I just wanna scale only x and z, but using same pivot as a reference point while the clothing is simulating

That's not possible using the transform component as I just explained. All existing cloth systems (including Unity's built-in cloth) have the same limitation, as it is simply a consequence of how matrix algebra works. Try scaling Unity's cloth at runtime and see.

The only way to do what you want is to modify is to calculate your own pivot point (could be the cloth's center of mass, a fixed point, whatever you agree on) and perform the transform yourself on particle positions directly, after simulation has been carried out.
Reply


Messages In This Thread
RE: Can I attach particeattachment in script? - by josemendez - 21-10-2024, 11:06 AM