Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Generated rope with pin constraints
#3
(07-05-2020, 02:11 PM)josemendez Wrote: Hi,

You've probably pinned the rope inside the cube, very close to its center of mass. This will result in two issues:
- The cube won't rotate, as any force applied very close to the center of mass of a rigidbody does not cause a rotation (or a really small one).
- The rope and the cube will generate a force-feedback loop, as there's now two constraints that can't be met at the same time:
  • PinConstraint: the end of the rope must be inside the cube.
  • CollisionConstraint: the end of the rope must be outside of the cube.

Clearly these two are at odds with each other: the collision constraint pushes the rope away from the collider, but the pin constraint pushes it back in. This results in the seizure-like behavior in your video.

This situation, and why it is undesirable is explained in the last part of the manual page for pin constraints:
http://obi.virtualmethodstudio.com/tutor...aints.html

Solutions:
- Set the last few particles in the rope to the same phase as the cube collider.
- Make sure the rope is pinned outside of the cube (the offset position you pass to the AddConstraint method is the position the particle will be pinned to, expressed in the collider's local space).

Let me know how it goes!

Hello Jose,
thank you for your answer.
The rope is pinned at the point where the ray hits the object:
Code:
batch.AddConstraint(blueprint.activeParticleCount - 1, hookAttachment.collider.GetComponent<ObiCollider>(),
     hookAttachment.transform.InverseTransformPoint(hookAttachment.point), Quaternion.identity);

The InTangentVector of the control point at that end of the rope points upwards.

I assume that this (and the feedback loop you mentioned) is the cause for the spazzing when I attach the rope to a vertical side of the cube/block and a stable behavior when the rope is attached on the top side of the block.

To quickly test it I moved the pin constraint -1m in the Z axis and it helped with the crazy movement.

Code:
batch.AddConstraint(blueprint.activeParticleCount - 1, hookAttachment.collider.GetComponent<ObiCollider>(),
     hookAttachment.transform.InverseTransformPoint(hookAttachment.point) + Vector3.back, Quaternion.identity);

Unfortunately something still keeps the block from rotating as long as the rope is attached.
The angular velocity is not just low, it quickly oscillates around zero and it does not change even if the small cube lands on the block.

I've uploaded the project to WeTransfer. You'll get the download link by email.
The size was too great for forum attachments (35MB zip including the Obi asset).
Could you please take a look at it?
Reply


Messages In This Thread
Generated rope with pin constraints - by pQuex - 07-05-2020, 01:21 PM
RE: Generated rope with pin constraints - by pQuex - 07-05-2020, 03:47 PM