Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  [Solved] Creating a ribbon
#1
Hi,
for a project I'm trying to create something akin to a ribbon, or an open conveyor belt.
It will only need to be simulated in two directions (X/Y) and it shouldn't rotate around the X-axis.
Getting it to simulate in two directions was easy, thanks to the 2D Solver setting, however the rope keeps randomly rotating around the X-axis. 'standing up'.
In another thread I read that rope particles don't have an up-vector, however they do seem to have some kind of rotational value stored, as they don't always seem to be pointing in the same direction.
Is it possible to restrict them from rotating around a specific axis? Or is there a way to disable the billboarding effect on the line renderer, to have it always face the same direction regardless of the camera?
Reply
#2
(23-05-2024, 01:22 PM)Elias Wrote: Hi,
for a project I'm trying to create something akin to a ribbon, or an open conveyor belt.
It will only need to be simulated in two directions (X/Y) and it shouldn't rotate around the X-axis.
Getting it to simulate in two directions was easy, thanks to the 2D Solver setting, however the rope keeps randomly rotating around the X-axis. 'standing up'.
In another thread I read that rope particles don't have an up-vector, however they do seem to have some kind of rotational value stored, as they don't always seem to be pointing in the same direction.

Hi Elias,

Rope particles aren't oriented indeed, they don't hold any kind of rotational information. For rendering, we use parallel transport, which assumes an initial orientation (the direction from the first particle in the rope to the second one) and then propagates it along the rope.

(23-05-2024, 01:22 PM)Elias Wrote: Is it possible to restrict them from rotating around a specific axis?

Not really, if you want to work with rotations you need to use a rod instead.

(23-05-2024, 01:22 PM)Elias Wrote: Or is there a way to disable the billboarding effect on the line renderer, to have it always face the same direction regardless of the camera?

No built-in way, but if you're comfortable writing code it's trivial to modify the line renderer to do this. I can help you do it, could you give more details about what your use case is? (a screenshot would go a long way! Sonrisa)

kind regards
Reply
#3
Thanks for the quick answer!

Shouldn't the initial rotation in one direction stay the same then, if forces are only ever applied in two directions? I considered using a rod, but I do need the freedom of movement I get from a rope.

   
This is the kind of look/behavior I'm trying to achieve

   
And this is the kind of rotation I'm trying to avoid. (In this example I'm using the mesh renderer)

I'd be glad if you could help me modify the line renderer, that might do the trick!
Reply
#4
(23-05-2024, 02:01 PM)Elias Wrote: Shouldn't the initial rotation in one direction stay the same then, if forces are only ever applied in two directions?

Hi Elias,

Forces are part of physics, they play no role in rendering.

During rendering, approximate orientations for rope particles are derived from particle positions, since the particles themselves lack orientation. The direction from one particle to the next determines 2 rotational degrees of freedom, but leaves the 3rd one free (rotation along the vector pointing from one particle to the next). This 3rd DOF is fixed using the cross product with the world's "up" vector, which yields a different torsion depending on which side of the "up" vector the rope is.

(23-05-2024, 02:01 PM)Elias Wrote: I considered using a rod, but I do need the freedom of movement I get from a rope.[/font][/size][/color]

Rods offer the same freedom of movement than a rope, but can be optionally made to keep their rest shape. Furthermore they also fully simulate torsion. Unless you need to cut/tear them or resize them using a cursor (neither of which are supported by rods) a rod would be a better match for your use case.

(23-05-2024, 02:01 PM)Elias Wrote: I'd be glad if you could help me modify the line renderer, that might do the trick!

Open up ObiRopeLineRenderer.cs, and around line 120 replace this:

Code:
normal.x = curve.Data[i].position.x - localSpaceCamera.x;
normal.y = curve.Data[i].position.y - localSpaceCamera.y;
normal.z = curve.Data[i].position.z - localSpaceCamera.z;
with this:
Code:
normal = curve.Data[i].binormal;

That should get you close to your desired result.

kind regards,
Reply
#5
I seem to have missed the fact that you can disable keeping the rest shape on rods, created a custom blueprint and now it works very closely to what I intended.
From here it's mostly tweaking, thank you so much!

The line rendering trick seems to work as well, I'll do some testing which is better for performance.
Reply