Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to define particle orientation?
#2
(10-01-2022, 09:50 AM)Romahaaa Wrote: Hi,

I am trying to implement ObiRope to reach such effect.
The rope is attached to Object A (draggable) from the top and to Object B (just a rigidbody object) from the bottom. At some point I need to spawn the elements on the rope and attach them but it's not enough just to know the position of particle (the point on the rope blueprint) but also need to know it's orientation/normal to spawn these objects in a correct rotation. 

I found some topics here that OBiRope particles doesn't have rotation. Is there any workaround how can I implement this? If it's not possible, maybe there is a way to attach these spawned elements while the rope is in the static state (in this case I may define required rotation referring to Object A rotation)?

Hi!

Indeed, the physical representation of a rope does not involve rotations. This is because each particle is simply a point (a position), and the rope is merely a sequence of points.

Rods do involve rotations, as they couple torsion (rotation around the rod's longitudinal axis) and bending (rotation around the other 2 axis).

For rendering a rope, Obi needs to have some rotation information though. Otherwise it would be impossible to draw the rope as anything else than a simple line. This is done using parallel transport: https://en.wikipedia.org/wiki/Parallel_transport

Basically, an initial rotation is determined from the first two particles in the rope: the direction that points from the first particle to the second one. Then this rotation is propagated trough the rope using parallel transport. Of course this only determines two rotation axis (torsion is undefined).

You can get this rotation from the ObiPathSmoother component, using its GetSectionAt() method:

Code:
ObiPathFrame pathFrame = pathSmoother.GetSectionAt();

The path frame contains normal, tangent and bitangent vectors, that define an orthonormal frame from which you can retrieve rotation in various ways. For instance, using Quaternion.LookAt(), or generating a matrix and extracting rotation from it (https://docs.unity3d.com/ScriptReference...4.TRS.html). As with everything in Obi, the rotation you'll get is expressed in solver space. You will probably need to convert it to world space using Unity's Transform methods.

The main issue with this method is that twist/torsion are undefined. If you need robust rotation on all 3 axis, using a rod is the only option.
Reply


Messages In This Thread
How to define particle orientation? - by Romahaaa - 10-01-2022, 09:50 AM
RE: How to define particle orientation? - by josemendez - 10-01-2022, 10:23 AM