Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to solidify particles
#1
Hi!

[Image: rope-issue.png]

The picture should show what I am tryng to achieve. My rope consists of two parts:
1. A static rod that is attached to the character's left hand
2. A dynamic rope that starts from the character's left hand

The rope is dynamically generated using two control points with tangent vectors, so the rope path points out from the character's hand to the correct direction. The rope attaches to the hand using a static attachment. This part works flawlessly.

However, after physics the rope is hanging towards the ground from its attachment. I would like it to be stiff in the first few particles, then loosen up, gradually, if possible. The first particles in the attachment should respect the original path direction.

How would you suggest I achieve this? Maybe adding some constraints to the first particles. I don't know how to do this, it gets complicated.

Here's the blueprint generating code.

Code:
this.Blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
this.Blueprint.resolution = 0.7f;
this.Blueprint.pooledParticles = 200;
this.Blueprint.thickness = 0.04f;
this.Blueprint.path.Clear();
this.Blueprint.path.AddControlPoint(ropeHolderLocalPosition, -ropeHolderLocalPosition, ropeHolderLocalPosition, Vector3.up, 0.1f, 0.1f, 1, collidesWithEverythingFilter, Color.white, "left-hand");
this.Blueprint.path.AddControlPoint(this.ParticleRope.transform.InverseTransformPoint(this.RopeAttachment.transform.position), -hookLocalPosition, hookLocalPosition, Vector3.up, 0.1f, 0.1f, 1, collidesWithEverythingFilter, Color.white, "hook");
this.Blueprint.path.FlushEvents();
yield return this.Blueprint.Generate();
Reply
#2
Hi,

Unless I'm missing something, wouldn't simply attaching the first couple particles in the rope to the hand achieve this?

You can see an example of this approach in the RopeShowcase sample scene, for the 3 ropes on the left wall: they're kept perpendicular to the wall using a couple attachments, then the progressive "loosening" is handled by bend constraints.

kind regards.
Reply
#3
(22-05-2024, 09:04 AM)josemendez Wrote: Hi,

Unless I'm missing something, wouldn't simply attaching the first couple particles in the rope to the hand achieve this?

You can see an example of this approach in the RopeShowcase sample scene, for the 3 ropes on the left wall: they're kept perpendicular to the wall using a couple attachments, then the progressive "loosening" is handled by bend constraints.

kind regards.

Oh, I see! This is exactly what I want.

I can see the magic is that those ropes are attached with two initial control points, "start" and "start 2". Then the only difference is the bending parameters.

So my solution should just add another control point close to the hand and attach that one also. I will try this and let you know.
Reply
#4
(22-05-2024, 09:43 AM)Jaakk0S Wrote: Oh, I see! This is exactly what I want.

I can see the magic is that those ropes are attached with two initial control points, "start" and "start 2". Then the only difference is the bending parameters.

So my solution should just add another control point close to the hand and attach that one also. I will try this and let you know.

Correct!

The idea is that infinite lines pass trough 1 point, so if you constrain only 1 point of any object (think nailing down a piece of wood using just 1 nail), it can rotate around that point freely. But if you constrain 2 points, then only one line passes trough them and the object can't rotate freely anymore.
Reply
#5
(22-05-2024, 10:04 AM)josemendez Wrote: Correct!

The idea is that infinite lines pass trough 1 point, so if you constrain only 1 point of any object (think nailing down a piece of wood using just 1 nail), it can rotate around that point freely. But if you constrain 2 points, then only one line passes trough them and the object can't rotate freely anymore.

Ok great, it works now, thank you.

Took me a while to get the tangents right cos I couldn't find a comment line or anything on AddControlPoint in the API docs. Turns out the tangent is a tangent, meaning it's a local space vector relative to the control point. Just it's not completely clear cos in the path editor it is shown as a local position that you drag around. Wouldn't hurt adding a line of help there.

Anyways thanks for great help and a great product. Cheers.
Reply