Posts: 5
Threads: 2
Joined: Aug 2024
Reputation:
0
Hi,
I am having issues with rendering a rope. When i get closer with the camera, the rope disappears. This only happens in a specific scene, on a specific solver. I duplicated solver values, so that is not a problem. This worked for me before updating to a newer version, now I am on version 7. I am creating the rope in runtime, here is the code:
Code: obiRope = EditingObject.GetComponent<ObiRope>();
var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
blueprint.path.Clear();
blueprint.path.AddControlPoint(Vector3.left, new Vector3(-.3f, 0), new Vector3(.3f, 0), Vector3.zero, 0.1f, 0.1f, .1f, filter, Color.white, "start");
blueprint.path.AddControlPoint(Vector3.right, new Vector3(-.3f, 0), new Vector3(.3f, 0), Vector3.zero, 0.1f, 0.1f, .1f, filter, Color.white, "end");
blueprint.path.FlushEvents();
obiRope.ropeBlueprint = blueprint;
For every change I do to the rope (changing the path, adding control points), I call:
Code: obiRope.path.FlushEvents();
StartCoroutine(obiRope.blueprint.Generate());
yield return new WaitForSecondsRealtime(1f);
obiRope.ResetParticles();
Video: https://drive.google.com/file/d/1lB2xcWD...sp=sharing
If you need anything else, please, tell me. I've been stuck on this problem for quite some time and can't seem to find a solution.
Thanks in advance!
Posts: 6,486
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
Yesterday, 02:07 PM
(This post was last modified: Yesterday, 02:09 PM by josemendez.)
Hi!
Select the solver and check what its bounds are in the scene view (they will appear as a white wire box). Your video looks as if the solver isn't being updated after adding the rope, and its previous bounds are getting out of the camera frustum.
If this is the cause indeed, I'd need to see the actual scene setup (not just the rope creation code) in order to find out the cause.
kind regards,
Posts: 5
Threads: 2
Joined: Aug 2024
Reputation:
0
(Yesterday, 02:07 PM)josemendez Wrote: Hi!
Select the solver and check what its bounds are in the scene view (they will appear as a white wire box). Your video looks as if the solver isn't being updated after adding the rope, and its previous bounds are getting out of the camera frustum.
If this is the cause indeed, I'd need to see the actual scene setup (not just the rope creation code) in order to find out the cause.
kind regards, Hi,
Thank you for your reply.
I do not see any wire/bounds in the scene. The same is in the scene, where everything works as it should. I checked if I disabled it in gizmos, but I didn't.
image_2025-05-21_160053825.png (Size: 9.83 KB / Downloads: 5)
It is correct for this time not to update the cable, because i want to have like a creator scene, where the time is stopped, and then when you play, you can test it. I tried to have Time.timeScale = 0, but the cable did not render, also tried to manually called UpdateBackend, but it still did not appear.
This is solver:
For create scene (where I do not need any simulation, only render), I have all constraints disabled:
Normal solver, in the game:
If you want, I can send you the whole scene, of course only the scene without all the junk, and you can check it out yourself what I'm doing wrong.
Posts: 6,486
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
Yesterday, 03:41 PM
(This post was last modified: Yesterday, 03:51 PM by josemendez.)
(Yesterday, 03:34 PM)Paul1 Wrote: Hi,
Thank you for your reply.
I do not see any wire/bounds in the scene.
Assuming gizmo rendering is enabled, this means the solver is disabled.
(Yesterday, 03:34 PM)Paul1 Wrote: The same is in the scene, where everything works as it should. I checked if I disabled it in gizmos, but I didn't.
If the solver is entirely disabled, whether existing meshes are rendered or not is up to chance since their bounds won't be updated. Meshes are automatically culled by Unity when their bounds get outside the camera, having bounds that do not match the mesh will result in improper culling.
(Yesterday, 03:34 PM)Paul1 Wrote: It is correct for this time not to update the cable, because i want to have like a creator scene, where the time is stopped, and then when you play, you can test it. I tried to have Time.timeScale = 0, but the cable did not render, also tried to manually called UpdateBackend, but it still did not appear.
If you want no simulation but still update meshes, bounds, and everything else (which seems like the sensible thing to do in a "creator"/"editor" kind of situation) keep the solver enabled but set its max steps per frame to zero. This will allow no physics steps during each frame, so time won't advance.
Entirely disabling the solver will disable simulation update, bounds update, rendering update, etc which you don't want in this case.
let me know if you need further help,
kind regards
Posts: 5
Threads: 2
Joined: Aug 2024
Reputation:
0
Solver is enabled. I added prefab of the object (the same 1 I am adding in runtime) in editor, before playing, and this one shows up. Also, I assume that bounds only shows when you are not playing and add the cable in editor. When I run, I see no bounds.
I also set max steps per frame to zero, so that is a nice optimization tip.
I checked camera values, nothing seems off.
In short, the only rope I don't see is the one I instantiate it in runtime. What do you think could be the reason?
Best
Posts: 6,486
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
10 hours ago
(This post was last modified: 10 hours ago by josemendez.)
(11 hours ago)Paul1 Wrote: Solver is enabled. I added prefab of the object (the same 1 I am adding in runtime) in editor, before playing, and this one shows up. Also, I assume that bounds only shows when you are not playing and add the cable in editor. When I run, I see no bounds.
Bounds should appear both in editor and during play mode, as long as the solver is enabled.
(11 hours ago)Paul1 Wrote: For create scene (where I do not need any simulation, only render), I have all constraints disabled:
Note this won't stop the simulation: particles will still move due to gravity, wind, forces, etc. Disabling all constraints only prevents particle velocities/positions from being constrained to each other or to objects in the scene.
(11 hours ago)Paul1 Wrote: I checked camera values, nothing seems off.
The thing I would check is the camera frustum vs the solver bounds to see if they intersect, but you mention there's no bounds visible in play mode which is rather weird.
(11 hours ago)Paul1 Wrote: In short, the only rope I don't see is the one I instantiate it in runtime. What do you think could be the reason?
The only reason I can think of for this is that the solver is disabled at the time of adding the rope, so the bounds are not being updated to include the new rope. This will cause it to be rendered as long as the old bounds (whatever they are) are inside the camera frustum.
Would it be possible for you to share the project by sending it to support(at)virtualmethodstudio.com so that I can take a closer look?
kind regards,
|