Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to drag a rope from any point of the rope
#1
I created a rope, and when I touch the rope and need to drag it from the touch point.

I can get the touch point on the rope, but how can I drag it?

I added an ObiParticleAttachment on the ObiRope, and I try to find the control point near my touch point, but I found all control points are the same and will never change, after changing the position of the rope.

So can I find the correct control point in runtime?
Reply
#2
(05-03-2021, 04:45 PM)wakin001 Wrote: I created a rope, and when I touch the rope and need to drag it from the touch point.

I can get the touch point on the rope, but how can I drag it?

I added an ObiParticleAttachment on the ObiRope, and I try to find the control point near my touch point, but I found all control points are the same and will never change, after changing the position of the rope.

So can I find the correct control point in runtime?

Control points do not exist at runtime. They’re only used in the editor, to help you define the initial shape of the rope. Being a particle-based engine, the simulation is done using particles.

If you want to drag ropes using the mouse, use (or base your own script on) ObiParticleDragger / ObiParticlePicker. The picker raycasts against all particles and triggers pick/drag/release events for the one closest to the ray, the dragger subscribes to those events and implements spring-based dragging.

Any more advanced interaction can be built using the particles API:

http://obi.virtualmethodstudio.com/tutor...icles.html

Cheers!
Reply
#3
to josemendez,
ObiParticlePicker/ObiParticleDragger works perfect.
Thanks for your help.
Reply