Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Get position of particle at end of rope
#4
(07-04-2021, 10:21 AM)josemendez Wrote: As you know, the ObiPathSmoother generates an intermediate representation of the rope that is used for rendering (see: http://obi.virtualmethodstudio.com/tutor...modes.html)

You can also get smoothed path positions along the rope, instead of working with raw particles/elements. For this you can use the path generator's GetSectionAt() method, that also takes a normalized coordinate as input. For instance, if you wanted to place an object at a position and orientation:

Code:
var generator = GetComponent<ObiPathSmoother>();
ObiPathFrame section = generator.GetSectionAt(m);
YourObject.transform.position = generator.transform.TransformPoint(section.position);
YourObject.transform.rotation = generator.transform.rotation * (Quaternion.LookRotation(section.tangent,section.binormal));

Thank you, this is exactly what I was after- however I'm still having some issues when the rope is shorter than it's starting length. 

When I reduce the rope length and then run this code, for some reason the dynamic particle attachment doesn't hold the object. 

Here is a quick example video. The first time a car is picked up, the rope length isn't changed. The second time the rope is made shorter than it's initial length. 

When the magnet collides w the car, it changes the dynamic attachment target from the magnet to the car, and sets itself as a kinematic rigidbody, parented to the car

When releasing the car, the dynamic attachment target is set to null, the magnet is moved to match the end of the rope, set to a non-kinematic rigidbody, and the dynamic attachment target is set back to the magnet.
Reply


Messages In This Thread
RE: Get position of particle at end of rope - by cfinger - 07-04-2021, 05:17 PM