Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Freezing a rope on runtime
#1
Hello!

In order to combat stretchy ropes and gaining some performance, I'm trying to freeze a rope 2 seconds after the player lets go of it and unfreeze it when the player picks it up again. I'm came across this response which helps a lot, I now instantiate the mesh and use that while the rope is frozen. However, I'm still running into an issue.

The rope is attached to an object using Particle Attachments. If the object it's attached to moves while the rope is frozen, the cable stays on it's frozen position.

How can I make sure the rope follows the object, even when it's frozen?
Reply
#2
(28-01-2021, 10:00 AM)Jesse Wrote: Hello!

In order to combat stretchy ropes and gaining some performance, I'm trying to freeze a rope 2 seconds after the player lets go of it and unfreeze it when the player picks it up again. I'm came across this response which helps a lot, I now instantiate the mesh and use that while the rope is frozen. However, I'm still running into an issue.

The rope is attached to an object using Particle Attachments. If the object it's attached to moves while the rope is frozen, the cable stays on it's frozen position.

How can I make sure the rope follows the object, even when it's frozen?

Hi there!

If I understood correctly, you're swapping the simulated rope for a baked mesh. The rope is attached to an object, and while the rope is "frozen" the object moves around but the rope does not follow it, correct?

The solution depends on whether you're using a static or a dynamic attachment. Static attachments work just like a parent-child relationship, so in that case you should be good by simply parenting the frozen rope mesh to the object it's attached to.

However if the attachment is dynamic, the object will be able to react to forces applied to the rope (think a ceiling lamp suspended from a cable). In this case you need the simulation to continue in order for the object to keep its current position, because once the rope is frozen the simulation will cease to apply any forces to the object and it will be free to move.

let me know if this helps Sonrisa. kind regards,
Reply
#3
(28-01-2021, 10:16 AM)josemendez Wrote: Hi there!

If I understood correctly, you're swapping the simulated rope for a baked mesh. The rope is attached to an object, and while the rope is "frozen" the object moves around but the rope does not follow it, correct?

The solution depends on whether you're using a static or a dynamic attachment. Static attachments work just like a parent-child relationship, so in that case you should be good by simply parenting the frozen rope mesh to the object it's attached to.

However if the attachment is dynamic, the object will be able to react to forces applied to the rope (think a ceiling lamp suspended from a cable). In this case you need the simulation to continue in order for the object to keep its current position, because once the rope is frozen the simulation will cease to apply any forces to the object and it will be free to move.

let me know if this helps Sonrisa. kind regards,

Works like a charm, thanks a lot! I had one side statically and the other dynamically attached. Changed them both to static attachments (they didn't have to be dynamic after all  Lengua ) and parented the rope to the object.

I have 6 ropes attached to that object and it turns out it saved me about 45 fps on average. That might mean I have other issues regarding optimization, could you point me to a resource for that?
Reply
#4
(28-01-2021, 11:41 AM)Jesse Wrote: Works like a charm, thanks a lot! I had one side statically and the other dynamically attached. Changed them both to static attachments (they didn't have to be dynamic after all  Lengua ) and parented the rope to the object.

I have 6 ropes attached to that object and it turns out it saved me about 45 fps on average. That might mean I have other issues regarding optimization, could you point me to a resource for that?


You should focus on optimizing what's currently taking up most time. Could be simulation, could be rope rendering, and lots of details within each one.

The best tool for optimization is Unity's profiler. See what the profiler tells you, and you'll know what to focus on. If you need help interpreting the profiler just post a screenshot (timeline mode, make sure a whole frame is visible).

Some overall tips:
- Coarser rope resolution = Less particles = better performance
- Less iterations / less substeps = better performance
- Less complex rope rendering = better performance (use less section segments, use decimation, use a ObiRopeLineRenderer instead of the default renderer, etc)

cheers!
Reply