Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  create Obi handle on script at runtime
#2
(23-05-2019, 10:42 AM)Richard Wrote: Can I create obi handle by script at runtime ?
I want to pick up particles by script, not by editor. I saw script of ObiClothParticleHandles, and I thought I can do that.
If yes, I want you to teach me how to do that.

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);


Messages In This Thread
RE: create Obi handle on script at runtime - by josemendez - 23-05-2019, 02:59 PM