Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi rope collision stops working after loading scene
#1
Hi, this is what I do...
I have a rope in Scene A.
Then I put that rope in DontDestroyOnLoad.
Then I load scene B.

After I have done that the rope does not collide with any obi collider in scene B! Opening the ropes path editor and changing something then closing it fixes the issue.
Enabling and disabling the rope also fixes the issue but sometimes completely breaks the rope so it aint reliable at all. 
So I guess there is a function that I need to call after the scene has finished loading to like update all obi colliders. But I dont know what the function is called.
I have tried [solver].updateBackend
Reply
#2
(22-12-2022, 12:53 AM)Zombie1111 Wrote: Hi, this is what I do...
I have a rope in Scene A.
Then I put that rope in DontDestroyOnLoad.
Then I load scene B.

After I have done that the rope does not collide with any obi collider in scene B! Opening the ropes path editor and changing something then closing it fixes the issue.

Hi!

I'm unable to reproduce this, loading a new scene while keeping ropes from the old one seems to work well for me. How are you doing this exactly, can you share your code?

(22-12-2022, 12:53 AM)Zombie1111 Wrote: Enabling and disabling the rope also fixes the issue but sometimes completely breaks the rope so it aint reliable at all. 

Disabling/enabling a rope should work fine, disabling simply takes the rope out of the solver and then re-adds it back when you enable it. Could you elaborate on how this "breaks" the rope?

(22-12-2022, 12:53 AM)Zombie1111 Wrote: So I guess there is a function that I need to call after the scene has finished loading to like update all obi colliders. But I dont know what the function is called.
I have tried [solver].updateBackend

Not really, when an ObiCollider is instantiated it is automatically accounted for, no need to call any function. solver.UpdateBackend basically removes all actors from the current solver, tears the backend down, reinitializes it and then re-adds all actors back. Similar to disabling all actors, checking if the backend has been modified, and then re-enabling them.

kind regards,
Reply
#3
(22-12-2022, 12:02 PM)josemendez Wrote: Hi!

I'm unable to reproduce this, loading a new scene while keeping ropes from the old one seems to work well for me. How are you doing this exactly, can you share your code?


Disabling/enabling a rope should work fine, disabling simply takes the rope out of the solver and then re-adds it back when you enable it. Could you elaborate on how this "breaks" the rope?


Not really, when an ObiCollider is instantiated it is automatically accounted for, no need to call any function. solver.UpdateBackend basically removes all actors from the current solver, tears the backend down, reinitializes it and then re-adds all actors back. Similar to disabling all actors, checking if the backend has been modified, and then re-enabling them.

kind regards,


I did some more testing and I was unable to fix the issue. However I found a workaround by simply just having the rope in scene B from the begining.

However during the testing I found weird issue. By doing this...
I have a rope in Scene A
Then I put that rope in DontDestroyOnLoad
Then I disable and enable the rope
Then I load scene B 

Unity crashes everytime I do that. I load the scene using loadingOperation = SceneManager.LoadSceneAsync(player_level);
Here is the crash log if its for any help
=================================================================
Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
Managed Stacktrace:
=================================================================
  at <unknown> <0xffffffff>
  at Oni:CollisionDetection <0x000ff>
  at Obi.OniSolverImpl:CollisionDetection <0x00162>
  at Obi.ObiSolver:BeginStep <0x01011>
  at Obi.ObiUpdater:BeginStep <0x0054a>
  at Obi.ObiLateUpdater:LateUpdate <0x0024a>
  at System.Object:runtime_invoke_void__this__ <0x00187>
=================================================================
Received signal SIGSEGV
Obtained 28 stack frames
0x00007ffda6affa91 (libOni) GetPointCloudAnisotropy
0x00007ffda6af40d0 (libOni) CollisionDetection
0x0000025fd7715e20 (Mono JIT Code) (wrapper managed-to-native) Oni:CollisionDetection (intptr,single)
0x0000025fd7715773 (Mono JIT Code) [OniSolverImpl.cs:187] Obi.OniSolverImpl:CollisionDetection (single)
0x0000025fd77044c2 (Mono JIT Code) [ObiSolver.cs:1540] Obi.ObiSolver:BeginStep (single)
0x0000025fd76ed95b (Mono JIT Code) [ObiUpdater.cs:63] Obi.ObiUpdater:BeginStep (single)
0x0000025fd560ef9b (Mono JIT Code) [ObiLateUpdater.cs:57] Obi.ObiLateUpdater:LateUpdate ()
0x00000260efdc3b48 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ffd73b1e034 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
0x00007ffd73a5e724 (mono-2.0-bdwgc) [object.c:3064] do_runtime_invoke
0x00007ffd73a5e8bc (mono-2.0-bdwgc) [object.c:3111] mono_runtime_invoke
0x00007ff709199364 (Unity) scripting_method_invoke
0x00007ff709193f84 (Unity) ScriptingInvocation::Invoke
0x00007ff709161914 (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007ff709161a1c (Unity) MonoBehaviour::CallUpdateMethod
0x00007ff708c5fac8 (Unity) BaseBehaviourManager::CommonUpdate<LateBehaviourManager>
0x00007ff708c66f1a (Unity) LateBehaviourManager::Update
0x00007ff708e7602d (Unity) `InitPlayerLoopCallbacks'::`2':LenguareLateUpdateScriptRunBehaviourLateUpdateRegistrator::Forward
0x00007ff708e5cfbc (Unity) ExecutePlayerLoop
0x00007ff708e5d093 (Unity) ExecutePlayerLoop
0x00007ff708e62ca9 (Unity) PlayerLoop
0x00007ff709d9a948 (Unity) PlayerLoopController::UpdateScene
0x00007ff709d98b2f (Unity) Application::TickTimer
0x00007ff70a1e0d0a (Unity) MainMessageLoop
0x00007ff70a1e55db (Unity) WinMain
0x00007ff70b4fd03e (Unity) __scrt_common_main_seh
0x00007ffe63267614 (KERNEL32) BaseThreadInitThunk
0x00007ffe64d426a1 (ntdll) RtlUserThreadStart
Reply