Obi Official Forum
Help move each particle of cloth - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Help move each particle of cloth (/thread-915.html)



move each particle of cloth - Richard - 18-02-2019

Hello. I would like to move each particle of cloth. My image is that pushing cloth from inside of tube shaped cloth. I want it to transform its shape depending on power.


RE: move each particle of cloth - josemendez - 19-02-2019

(18-02-2019, 03:22 PM)Richard Wrote: Hello. I would like to move each particle of cloth. My image is that pushing cloth from inside of tube shaped cloth. I want it to transform its shape depending on power.

Hi,

You can get/set any of the particle properties (positions, velocities, radii, etc) using the arrays in the solver class. See the docs for details:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html


RE: move each particle of cloth - Richard - 19-02-2019

(19-02-2019, 09:10 AM)josemendez Wrote: Hi,

You can get/set any of the particle properties (positions, velocities, radii, etc) using the arrays in the solver class. See the docs for details:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

I cannot image how to do. What if I move some of particles to X axis and then Z axis?


RE: move each particle of cloth - josemendez - 19-02-2019

(19-02-2019, 09:26 AM)Richard Wrote: I cannot image how to do. What if I move some of particles to X axis and then Z axis?

Hi,

Particle positions use the standard Unity Vector4 datatype. So to set the X value and the Z value, you simply pass them to the constructor as you normally would.

Code:
solver.positions[index] = new Vector4(x,y,z,0);

Please refer to Unity's documentation for more info how to use the Vector4 class.


RE: move each particle of cloth - Richard - 19-02-2019

(19-02-2019, 11:48 AM)josemendez Wrote: Hi,

Particle positions use the standard Unity Vector4 datatype. So to set the X value and the Z value, you simply pass them to the constructor as you normally would.

Code:
solver.positions[index] = new Vector4(x,y,z,0);

Please refer to Unity's documentation for more info how to use the Vector4 class.

Hello. 

How can I pick up particles on script? I want to choose particles like around arms and shoulders.