Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  create Obi handle on script at runtime
#3
(23-05-2019, 02:59 PM)josemendez Wrote: Hi Richard,

Handles have a very simple API: you can add particle indices to them, or remove particle indices from them. That's pretty much it:
http://obi.virtualmethodstudio.com/api.html

For instance, to create a handle that fixes the position of the first two particles in a cloth:

Code:
// Create a new game object and add the handle component:
GameObject obj = new GameObject("Obi Handle");
ObiParticleHandle handle = obj.AddComponent<ObiParticleHandle>();

// Add the first two particles to it:
handle.AddParticle(i, actor.GetParticlePosition(0),Quaternion.identity,actor.invMasses[0],0);
handle.AddParticle(i, actor.GetParticlePosition(1),Quaternion.identity,actor.invMasses[1],0);

I checked API, but how can I choose particle like
float left = Mathf.Min(startPos.x,currentPos.x);
float right = Mathf.Max(startPos.x,currentPos.x);
float bottom = Mathf.Min(startPos.y,currentPos.y);
float top = Mathf.Max(startPos.y,currentPos.y);
of "ObiClothParticleEditor" on script by assigning number?


Messages In This Thread
RE: create Obi handle on script at runtime - by Richard - 24-05-2019, 07:32 AM