Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Only render ropes
#1
Hi Jose,

I'm experimenting with ropes that simulate on the server and render on the client. Is it possible to disable simulation and only enable rendering? 

Jesse
Reply
#2
(11-03-2021, 09:30 AM)Jesse Wrote: Hi Jose,

I'm experimenting with ropes that simulate on the server and render on the client. Is it possible to disable simulation and only enable rendering? 

Jesse

Hi Jesse,

The ObiSolver component is in charge of performing the simulation, so simply disable it. The rope will still be rendered.
Reply
#3
(11-03-2021, 12:00 PM)josemendez Wrote: Hi Jesse,

The ObiSolver component is in charge of performing the simulation, so simply disable it. The rope will still be rendered.

I tried that, but when I disable the ObiSolver it stops rendering the rope. Am I missing something?
I am using the URP, maybe that has something to do with it?

Here's my rope and solver settings, basically all default.

[Image: pXoVwQu.png][Image: 4rgVvlV.png]
Reply
#4
(11-03-2021, 02:07 PM)Jesse Wrote: I tried that, but when I disable the ObiSolver it stops rendering the rope. Am I missing something?
I am using the URP, maybe that has something to do with it?

Here's my rope and solver settings, basically all default.

[Image: pXoVwQu.png][Image: 4rgVvlV.png]

Hi,

I’m unable to reproduce this, what Obi version are you using?
Reply
#5
(11-03-2021, 02:47 PM)josemendez Wrote: Hi,

I’m unable to reproduce this, what Obi version are you using?

Hmmm.. I'm using 6.0.1 with Unity 2019.4. I'll try again in a fresh project.

I unfortunately have the same result in a fresh project. Tested with Obi 6.0.1 with Unity 2019.4 and 2020.1.
Reply
#6
(11-03-2021, 03:00 PM)Jesse Wrote: Hmmm.. I'm using 6.0.1 with Unity 2019.4. I'll try again in a fresh project.

I unfortunately have the same result in a fresh project. Tested with Obi 6.0.1 with Unity 2019.4 and 2020.1.

Still unable to get this to happen, Obi 6.0.1, Unity 2019.4.
When disabling the solver, the engine is no longer updated. The rope renderer also stops updating the mesh, but the mesh is still assigned to the MeshRenderer so it should be rendered. Here's a video:



Now that I think of it, this might not be what you're after. You want to override particle positions with custom data, but still have the mesh updated from the particle positions. For that, you'll have to call the actor's Interpolate() method, which interpolates particle positions and triggers mesh update.
Reply
#7
(11-03-2021, 03:52 PM)josemendez Wrote: Still unable to get this to happen, Obi 6.0.1, Unity 2019.4.
When disabling the solver, the engine is no longer updated. The rope renderer also stops updating the mesh, but the mesh is still assigned to the MeshRenderer so it should be rendered. Here's a video:



Now that I think of it, this might not be what you're after. You want to override particle positions with custom data, but still have the mesh updated from the particle positions. For that, you'll have to call the actor's Interpolate() method, which interpolates particle positions and triggers mesh update.

Thanks for the video! I've tested it in the same sample scene and I've found that it only works if I disable the ObiSolver on runtime. I had mine disabled in the editor. It makes sense that has to call Interpolate() at least once for the mesh to update.

I'm setting the particles directly in the solver, I assume I can skip the interpolation step and call ObiRopeExtrudedRenderer.UpdateRenderer() directly?
Reply
#8
(11-03-2021, 04:15 PM)Jesse Wrote: Thanks for the video! I've tested it in the same sample scene and I've found that it only works if I disable the ObiSolver on runtime. I had mine disabled in the editor. It makes sense that has to call Interpolate() at least once for the mesh to update.

Disabling it in editor will prevent the mesh from even being generated, so that's expected behavior.

(11-03-2021, 04:15 PM)Jesse Wrote: I'm setting the particles directly in the solver, I assume I can skip the interpolation step and call ObiRopeExtrudedRenderer.UpdateRenderer() directly?

The data flow is: particles (ObiActor)->smoothed curve (ObiPathSmoother)->updating the mesh(ObiRopeExtrudedRenderer). To update the mesh, the renderer uses points from the smoothed/decimated curve, not particle positions directly.

At the very least you'll need to call the ObiPathSmoother's GenerateSmoothChunks() method, followed by the renderer's UpdateRenderer() method.

cheers!
Reply
#9
(11-03-2021, 04:37 PM)josemendez Wrote: Disabling it in editor will prevent the mesh from even being generated, so that's expected behavior.


The data flow is: particles (ObiActor)->smoothed curve (ObiPathSmoother)->updating the mesh(ObiRopeExtrudedRenderer). To update the mesh, the renderer uses points from the smoothed/decimated curve, not particle positions directly.

At the very least you'll need to call the ObiPathSmoother's GenerateSmoothChunks() method, followed by the renderer's UpdateRenderer() method.

cheers!

Awesome, thanks a lot!
Reply
#10
Hi Jose, sorry to bother you again. I still can't get the rendering to work by setting the solver positions and velocities through SetVector3() and calling ObiRope.Interpolate() afterwards. Here's the code snippet:

Code:
for (int i = 0; i < synchronizedData.Indeces.Length; ++i)
{
    _obiRope.solver.positions.SetVector3(synchronizedData.Indeces[i], synchronizedData.Positions[i]);
    _obiRope.solver.velocities.SetVector3(synchronizedData.Indeces[i], synchronizedData.Velocities[i]);
}

_obiRope.Interpolate();


I've found that some of the particles (what looks like the first 10 or so) do get set correctly with the VelocityVisualizer script, I can see the visualized velocities for these particles. The ObiParticleRenderer does not show the updated positions, it seems to flicker on and off. This might be an issue in my networking code, however the mesh is not updated.

ObiRopeExtrudedRender.UpdateRenderer() does run, so I'm not sure what I'm missing..

Here's a video, this is with the solver disabled:
Reply