Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Changing the rope's position
#3
(08-05-2024, 05:33 PM)Crystalius Wrote: Hello. I've been struggling with moving the rope where I want to. My goal at the moment is to disable the solver along with the rope when I don't need them for performance reasons, but when I re-enable them the position is kept old, which is understandable of course. What would be the simplest way to move the rope after I enable it? I've read your discussion about that in another thread from 2020 but I couldn't recreate their script in Unity's visual scripting. 

Hi!

rope.Teleport(position, rotation); should work. See Spikebor's code above for what seems like a complete solution that supports parent transforms and resetting particles as well.

(08-05-2024, 05:33 PM)Crystalius Wrote: I can easily get the positions with ObiRope GetParticlePosition. But how would I set them? If it was the same as getting them and iterating through all the particles I probably wouldn't be writing here.

GetParticlePosition() is mostly used from editor, as it abstracts away the differences between play mode /editor when it comes to rendering particles. At runtime usually you would directly access the solver's data arrays, that contain all per-particle data: positions, velocities, etc. This is what Teleport() does internally: it iterates trough all particle positions and rotates/translates them.

See:
http://obi.virtualmethodstudio.com/manua...icles.html

kind regards,
Reply


Messages In This Thread
Changing the rope's position - by Crystalius - 08-05-2024, 05:33 PM
RE: Changing the rope's position - by spikebor - 09-05-2024, 05:59 AM
RE: Changing the rope's position - by josemendez - 09-05-2024, 08:05 AM
RE: Changing the rope's position - by Crystalius - 09-05-2024, 08:54 AM