Posts: 4
Threads: 1
Joined: Mar 2023
Reputation:
0
Hi!
I’ve been using Obi Rope in my game and the asset has been amazing! For some reason though, I’m experiencing a weird rope stuttering issue when I enable Rigidbody interpolation on a static particle attachment. The rope is attached to the player using a static particle attachment but whenever I enable interpolation on the player Rigidbody, the rope attachment particle starts jittering. Any ideas why this is happening?
Thanks in advance!
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
06-03-2023, 08:13 AM
(This post was last modified: 06-03-2023, 08:21 AM by josemendez.)
(06-03-2023, 12:31 AM)VirtualV Wrote: Hi!
I’ve been using Obi Rope in my game and the asset has been amazing! For some reason though, I’m experiencing a weird rope stuttering issue when I enable Rigidbody interpolation on a static particle attachment. The rope is attached to the player using a static particle attachment but whenever I enable interpolation on the player Rigidbody, the rope attachment particle starts jittering. Any ideas why this is happening?
Thanks in advance!
Hi there!
Rigidbody interpolation should not change rope behavior at all (or rigidbody's, for that matter). It only modifies the visual position/rotation of the rigidbody to smoothly interpolate physics state during frames where no physics update has taken place.
Probably what you're experiencing is the rigidbody no longer being visually updated in sync with the rope. In this case, you should enable interpolation in your ObiSolver component too, so that both rigidbodies and ropes are interpolated.
Note that statically attached particles are not interpolated, since they are driven purely by simulation. If you want static particles to be interpolated too (which is usually undesirable), open up ObiParticleAttachment.cs and:
1) modify lines 167 and 181 to subscribe to/unsubscribe from to OnBeginStep instead:
Code: m_Actor.OnBeginStep += Actor_OnPrepareStep;
Code: m_Actor.OnBeginStep -= Actor_OnPrepareStep;
2) modify line 430 so that the startPosition is not modified:
Code: solver.positions[solverIndex] = attachmentMatrix.MultiplyPoint3x4(m_PositionOffsets[i]);
kind regards,
Posts: 4
Threads: 1
Joined: Mar 2023
Reputation:
0
(06-03-2023, 08:13 AM)josemendez Wrote: Hi there!
Rigidbody interpolation should not change rope behavior at all (or rigidbody's, for that matter). It only modifies the visual position/rotation of the rigidbody to smoothly interpolate physics state during frames where no physics update has taken place.
Probably what you're experiencing is the rigidbody no longer being visually updated in sync with the rope. In this case, you should enable interpolation in your ObiSolver component too, so that both rigidbodies and ropes are interpolated.
Note that statically attached particles are not interpolated, since they are driven purely by simulation. If you want static particles to be interpolated too (which is usually undesirable), open up ObiParticleAttachment.cs and:
1) modify lines 167 and 181 to subscribe to/unsubscribe from to OnBeginStep instead:
Code: m_Actor.OnBeginStep += Actor_OnPrepareStep;
Code: m_Actor.OnBeginStep -= Actor_OnPrepareStep;
2) modify line 430 so that the startPosition is not modified:
Code: solver.positions[solverIndex] = attachmentMatrix.MultiplyPoint3x4(m_PositionOffsets[i]);
kind regards,
Thank you for the response! After experimenting some more, I’ve found that the stuttering issue only occurs with the Obi Rope Extruder Render, not the Obi Particle Render. As you can see in the attached video, the Obi Particle Render works perfectly but when I enable the Obi Extruder Renderer, the issue appears again.
Thank you for your assistance!
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
06-03-2023, 09:16 PM
(This post was last modified: 06-03-2023, 09:25 PM by josemendez.)
(06-03-2023, 08:56 PM)VirtualV Wrote: Thank you for the response! After experimenting some more, I’ve found that the stuttering issue only occurs with the Obi Rope Extruder Render, not the Obi Particle Render. As you can see in the attached video, the Obi Particle Render works perfectly but when I enable the Obi Extruder Renderer, the issue appears again.
Thank you for your assistance!
Hi!
Can’t see any video attached to your post or any link(s). Maybe you forgot to add it?
Both the particle renderer and the extruded rendered use the exact same rope physics state to render (all renderers do in fact) so at least in theory, output should be identical.
Off the top of my head, only possible source of jittering when using an extruded rendered would be using non-zero decimation in the ObiPathSmoother component. This will introduce some curvature jittering at the benefit of simplifying rope geometry and improving performance for mostly straight ropes. Check whether decimation is set to a value larger than zero and if it is, setting it to zero should get rid of all jittering.
Kind regards,
Posts: 4
Threads: 1
Joined: Mar 2023
Reputation:
0
06-03-2023, 09:30 PM
(This post was last modified: 06-03-2023, 10:04 PM by VirtualV.
Edit Reason: Small note
)
(06-03-2023, 09:16 PM)josemendez Wrote: Hi!
Can’t see any video attached to your post or any link(s). Maybe you forgot to add it?
Both the particle renderer and the extruded rendered use the exact same rope physics state to render (all renderers do in fact) so at least in theory, output should be identical.
Off the top of my head, only possible source of jittering when using an extruded rendered would be using non-zero decimation in the ObiPathSmoother component. This will introduce some curvature jittering at the benefit of simplifying rope geometry and improving performance for mostly straight ropes. Check whether decimation is set to a value larger than zero and if it is, setting it to zero should get rid of all jittering.
Kind regards,
I can't seem to attach the video so I uploaded it to Streamable: https://streamable.com/ueed9z
(06-03-2023, 09:16 PM)josemendez Wrote: Hi!
Can’t see any video attached to your post or any link(s). Maybe you forgot to add it?
Both the particle renderer and the extruded rendered use the exact same rope physics state to render (all renderers do in fact) so at least in theory, output should be identical.
Off the top of my head, only possible source of jittering when using an extruded rendered would be using non-zero decimation in the ObiPathSmoother component. This will introduce some curvature jittering at the benefit of simplifying rope geometry and improving performance for mostly straight ropes. Check whether decimation is set to a value larger than zero and if it is, setting it to zero should get rid of all jittering.
Kind regards,
I created a quick scene to demonstrate the issue: https://streamable.com/chzems I’ve tried playing around with the decimation factor but it hasn’t had any effect
Thank you!
Edit: I forgot to mention that turning on interpolation on the Obi Solver doesn't solve the issue
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
07-03-2023, 08:41 AM
(This post was last modified: 07-03-2023, 08:51 AM by josemendez.)
(06-03-2023, 09:30 PM)VirtualV Wrote: I can't seem to attach the video so I uploaded it to Streamable: https://streamable.com/ueed9z
I created a quick scene to demonstrate the issue: https://streamable.com/chzems I’ve tried playing around with the decimation factor but it hasn’t had any effect
Thank you!
Edit: I forgot to mention that turning on interpolation on the Obi Solver doesn't solve the issue
This is just my guess, but it looks as if the rope is parented to the object it's attached to.
This is in essence doubly-parenting the rope to the object and will have the effect of translating the mesh during frames where there's no physics update (due to it being a child of the rigidbody) then re-creating the mesh back at its physical position during physics updates, which explains the jittering since interpolation is always 1 frame behind the actual physics state:
- create mesh at the position dictated by physics.
- the mesh moves due to interpolation because it's parented to the rigidbody.
- mesh is created back at the position dictated by physics.
- translated forward again due to parenting.
etc.
This would only affect mesh-based rendering (particles are not actual meshes, it's a shader trick).
Not sure if this is your case, but if it is the solution should be as simple as taking the rope outside the hierarchy of the object so that it's driven by physics alone.
If it isn't, would it be possible for you to share your Unity scene so that I can take a closer look at it?
kind regards,
Posts: 4
Threads: 1
Joined: Mar 2023
Reputation:
0
(07-03-2023, 08:41 AM)josemendez Wrote: This is just my guess, but it looks as if the rope is parented to the object it's attached to.
This is in essence doubly-parenting the rope to the object and will have the effect of translating the mesh during frames where there's no physics update (due to it being a child of the rigidbody) then re-creating the mesh back at its physical position during physics updates, which explains the jittering since interpolation is always 1 frame behind the actual physics state:
- create mesh at the position dictated by physics.
- the mesh moves due to interpolation because it's parented to the rigidbody.
- mesh is created back at the position dictated by physics.
- translated forward again due to parenting.
etc.
This would only affect mesh-based rendering (particles are not actual meshes, it's a shader trick).
Not sure if this is your case, but if it is the solution should be as simple as taking the rope outside the hierarchy of the object so that it's driven by physics alone.
If it isn't, would it be possible for you to share your Unity scene so that I can take a closer look at it?
kind regards,
Thank you for the response! I quickly created a new project that showcases the issue. The rope is not parented to any objects in the scene. You can download the project here as a .zip: https://drive.google.com/file/d/1exHQlfd...sp=sharing
The project doesn’t include the Obi Rope package which needs to be imported and the editor restarted.
Based on your reply, I believe the issue may have to do with attaching a static particle attachment to an interpolated Rigidbody, equivalent to parenting the rope. If this is the cause of the issue, do you have any idea on how I can fix it?
Thanks again!
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
08-03-2023, 03:52 PM
(This post was last modified: 08-03-2023, 04:00 PM by josemendez.)
(07-03-2023, 08:20 PM)VirtualV Wrote: Thank you for the response! I quickly created a new project that showcases the issue. The rope is not parented to any objects in the scene. You can download the project here as a .zip: https://drive.google.com/file/d/1exHQlfd...sp=sharing
The project doesn’t include the Obi Rope package which needs to be imported and the editor restarted.
Based on your reply, I believe the issue may have to do with attaching a static particle attachment to an interpolated Rigidbody, equivalent to parenting the rope. If this is the cause of the issue, do you have any idea on how I can fix it?
Thanks again!
Hi,
Enabling interpolation in the solver and modifying the ObiParticleAttachment script as described in my first answer seems to solve the issue in the example project you shared: statically attached particles are not interpolated by default, so they will behave as if the object they're attached to is not interpolated. Modifying the script enables interpolation for statically attached particles:
Also, note that in your scene the "Hook-Bottom" rigidbody is not interpolated, so it will jitter relative to both the rope and the Rigidbody-Camera object as a result. If you're going to use interpolation, it's best to use it for all related objects. Note too that interpolation in any engine introduces a roughly 1-frame delay in the position of all objects vs their actual physics state (since you're interpolating their current state and their previous state), so it will introduce a slight offset in things like attachments/joints/collisions.
kind regards,
|