Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rope/rod freezing
#1
I need to reset a rope to blueprint and freeze it. In addition, ideally I need to set the rope's parent to some object without a solver. I'm calling ResetParticles, but the rope's shape stays the same as the last frame before this procedure.
So.. can I reset particles and move the rope outside of solver, or this is not recommended? If I can, what other calls should I make to update the visuals of the rope after resetting?
Reply
#2
(17-02-2024, 02:59 PM)stepkka Wrote: I need to reset a rope to blueprint and freeze it.

Hi!

Define "freeze": just completely freeze in place, behave like a rigidbody, stop being simulated but still able to be programmatically deformed...?

(17-02-2024, 02:59 PM)stepkka Wrote: In addition, ideally I need to set the rope's parent to some object without a solver.

If you want the rope to still be simulated or rendered, it needs to have a ObiSolver above it in the scene hierarchy. Depending on your use case, you might be able to just take the rope's mesh and apply it to a regular object, then have it rendered normally or simulated as a rigid object that doesn't need to be part of a solver.

(17-02-2024, 02:59 PM)stepkka Wrote: I'm calling ResetParticles, but the rope's shape stays the same as the last frame before this procedure.

ResetParticles will reset particle positions to the ones specified in the blueprint, but will not prevent them from being simulated normally. This said, the rope should go back to the pose it was in when first loaded into the solver, I've been unable to reproduce it staying the same as the last frame. How are you calling ResetParticles()?

(17-02-2024, 02:59 PM)stepkka Wrote: So.. can I reset particles and move the rope outside of solver, or this is not recommended?

It is not possible to move an actor outside of the solver, in case you want it to be updated at all. See:
http://obi.virtualmethodstudio.com/manua...olver.html

Quote:Every actor needs to have a solver up its hierarchy in order to get updated and rendered.

Depending on your use case and what you mean by freezing, there's better/simpler solutions. Could you go into further details?

kind regards,
Reply
#3
Quote:Define "freeze": just completely freeze in place, behave like a rigidbody, stop being simulated but still able to be programmatically deformed...?

I want to freeze it mainly to stop being simulated, when it is, for example, too far from player. Or in case of my fishing rod, I want to stop simulating it while it is stored in a vehicle trunk or something like that. With that, I still need it to be visible, just as a static model.
Also, I need to set the parent of the fishing rod to some transform in the vehicle hierarchy (as it's supposed to move with the vehicle), and the vehicle does not have a solver.

Quote:ResetParticles will reset particle positions to the ones specified in the blueprint, but will not prevent them from being simulated normally. This said, the rope should go back to the pose it was in when first loaded into the solver, I've been unable to reproduce it staying the same as the last frame. How are you calling ResetParticles()?

My plan was to reset the fishing rod to the blueprint state and parent it to a vehicle object. It does not need to be simulated, can be just static model. 

Then I will make blueprint to look like a stored fishing rod (line wrapped around, hook attached to the rod, something like that).
I'm trying to avoid full simulation while fishing rod is not used, as it takes too much time. (3-8 ms, I might also need help with optimizing that).

So I'm calling ResetParticles then I parent the fishing rod's transform to my vehicle's trunk, which does not have a solver. The fishing rod gets frozen, still drawn just like I want, but the shape of the rope is still the same as before this procedure, and not like in the blueprint. I recon maybe one frame needs to be passed before un-parenting the rope from solver for it to be updated? Or are there functions I can call to manually update the rope visuals? Maybe it's the Obi Line renderer or path smoother that need to be updated manually?

Thanks for help!
Reply
#4
Hi!

(19-02-2024, 12:24 PM)stepkka Wrote: So I'm calling ResetParticles then I parent the fishing rod's transform to my vehicle's trunk, which does not have a solver. The fishing rod gets frozen, still drawn just like I want, but the shape of the rope is still the same as before this procedure, and not like in the blueprint.

What's happening here is that the particles (and all simulation data) for the rope get removed from the solver, and the object's mesh gets frozen in the latest shape it had while particles were alive. This is fine for your use case, I think.

(19-02-2024, 12:24 PM)stepkka Wrote: I recon maybe one frame needs to be passed before un-parenting the rope from solver for it to be updated?

Correct: ResetParticles() sets the position of particles to those in the blueprint, but until the solver has had a chance to execute its LateUpdate() the mesh won't reflect any changes to particles made during the current frame. You need to wait at least one frame for the rope mesh to reflect the new particle positions.

kind regards,
Reply