Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Renderable positions don't match rendered curve positions
#1
Hi!
I might have misunderstood the documentation, but what I essentially want to do is get the world position of two particles on the rope and align a sprite transform with it.
It seems like the positions in the ObiSolver's renderablePositions-array and the positions I get back from ObiRope.GetParticlePosition() don't match the one's used to render the rope mesh.

Is this expected behaviour and is there something I can do to get a precise world position on the rope curve at runtime?
Thanks and let me know if I need to clarify my issue more!  Sonrisa
Reply
#2
(21-10-2019, 11:51 AM)meshpotato Wrote: Hi!
I might have misunderstood the documentation, but what I essentially want to do is get the world position of two particles on the rope and align a sprite transform with it.
It seems like the positions in the ObiSolver's renderablePositions-array and the positions I get back from ObiRope.GetParticlePosition() don't match the one's used to render the rope mesh.

Is this expected behaviour and is there something I can do to get a precise world position on the rope curve at runtime?
Thanks and let me know if I need to clarify my issue more!  Sonrisa

Hi there,

Keep in mind that renderablePositions are expressed in local space if you are using local space simulation (see: http://obi.virtualmethodstudio.com/tutor...space.html) while GetParticlePosition() always returns them expressed in world space.

To get the world space position of a particle reliably both at runtime and in editor, use rope.GetParticlePosition(). This is what is used to render the rope (see SmoothCurvesFromParticles() in ObiRope.cs, it generates the rope bézier curves used for rendering. Gets them in world space using GetParticlePosition(), then transforms them to the rope's local space multiplying by transform.worldToLocalMatrix).
Reply