Posts: 30
Threads: 6
Joined: Apr 2020
Reputation:
0
Hey Guys, I just discovered Obi Rope, and All Obi assets by you on asset store and Currently I Use obi rope and I'm curious how to add points to rope in real time.
Here is an example
https://www.youtube.com/watch?v=cR6W1QCK7P4
Posts: 30
Threads: 6
Joined: Apr 2020
Reputation:
0
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
16-06-2020, 10:32 AM
(This post was last modified: 16-06-2020, 10:32 AM by josemendez.)
(16-06-2020, 09:46 AM)davidsedrakyan Wrote: Anyone can HELP me ?
Hi david,
In the video you posted they're simply adding static attachments to the rope. So add a ObiParticleAttachment component to the rope, and pass the target transform and particle group (which is basically a list of particle indices) you want to attach together.
Here's the docs on attachments:
http://obi.virtualmethodstudio.com/tutor...ments.html
Let me know if you need further help.
Posts: 30
Threads: 6
Joined: Apr 2020
Reputation:
0
(16-06-2020, 10:32 AM)josemendez Wrote: Hi david,
In the video you posted they're simply adding static attachments to the rope. So add a ObiParticleAttachment component to the rope, and pass the target transform and particle group (which is basically a list of particle indices) you want to attach together.
Here's the docs on attachments:
http://obi.virtualmethodstudio.com/tutor...ments.html
Let me know if you need further help.
Thanks for the answer, as I understand I need to reycast when the user clicks on the rope, and get the exact point of the particle, but I also need the point to be added on the particle blueprint right? I can't understand how to add a point to the particle blueprint and how to get point-particle of that point that user clicked.
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
16-06-2020, 02:34 PM
(This post was last modified: 16-06-2020, 02:39 PM by josemendez.)
(16-06-2020, 01:49 PM)davidsedrakyan Wrote: Thanks for the answer, as I understand I need to reycast when the user clicks on the rope, and get the exact point of the particle, but I also need the point to be added on the particle blueprint right? I can't understand how to add a point to the particle blueprint and how to get point-particle of that point that user clicked.
Hi there,
There's a class already that raycasts against all particles in a solver and returns the one that was hit: ObiParticlePicker. You can subscribe to any of its events: they receive a ParticlePickEventArgs struct as parameter, that contains both the particle index and its world space position.
Once you've got the index of the particle, you simply create a particle group that contains this index, and pass it to the attachment's particleGroup property. That's all.
I don't understand what you mean when you say "add points to the blueprint". You're referring to path control points, particles, or particle groups? By default, when you create a new control point in the editor, a particle group (that contains the index of the particle at that control point) is added to the blueprint for convenience. However particle groups can exist on their own (they're scriptable objects) there's no need to add new ones to the blueprint if you're creating/using them at runtime.
Posts: 30
Threads: 6
Joined: Apr 2020
Reputation:
0
(16-06-2020, 02:34 PM)josemendez Wrote: Hi there,
There's a class already that raycasts against all particles in a solver and returns the one that was hit: ObiParticlePicker. You can subscribe to any of its events: they receive a ParticlePickEventArgs struct as parameter, that contains both the particle index and its world space position.
Once you've got the index of the particle, you simply create a particle group that contains this index, and pass it to the attachment's particleGroup property. That's all.
I don't understand what you mean when you say "add points to the blueprint". You're referring to path control points, particles, or particle groups? By default, when you create a new control point in the editor, a particle group (that contains the index of the particle at that control point) is added to the blueprint for convenience. However particle groups can exist on their own (they're scriptable objects) there's no need to add new ones to the blueprint if you're creating/using them at runtime.
I guess I understand now, I will check this out, meanwhile I have another one question, I'm just learning all the obi stuff!)
So question is, I need call on 3d object some sort of "OnCollisionEnter()" function, like in normal unity physics, for example when cube collides with rope I want to deactivate cube, or add force to the cube, like in unity collision detection system, some sort of OnCollisionEnter function, where can I get info about that?
Posts: 6,321
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(19-06-2020, 11:48 AM)davidsedrakyan Wrote: I guess I understand now, I will check this out, meanwhile I have another one question, I'm just learning all the obi stuff!)
So question is, I need call on 3d object some sort of "OnCollisionEnter()" function, like in normal unity physics, for example when cube collides with rope I want to deactivate cube, or add force to the cube, like in unity collision detection system, some sort of OnCollisionEnter function, where can I get info about that?
You can get a list of all contacts in a frame by subscribing to the solver's OnCollision event:
http://obi.virtualmethodstudio.com/tutor...sions.html
New contacts (OnCollisionEnter), contacts that have disappeared (OnCollisionExit) and persistent contacts (OnCollisionStay) can easily be identified using set operations like Except ( https://www.dotnetperls.com/except).
That is, you keep the list of contacts from the previous frame, and the current list of contacts. Perform an Except between the two, and you get all contacts that are in the new frame that weren't in the previous frame. This is how Unity generates these events internally too.
|