04-10-2023, 09:33 PM
Hello!
I have the rope set up in such a way where one spawns after the player character fires a bow at the ceiling, and when the arrow hits the ceiling, a rope extends downward, so that the character can climb up it. When the arrow hits the ceiling, everything spawns (solver, updater, renderer, etc.), along with a weight at the bottom of the rope so that the rope is always calm and held down as it gradually extends towards the ground. Everything works great and looks really good. Also I can do this pretty much as many times as I want (i.e. fire a bunch of arrows at the ceiling, one after another, and all of them spawn their own ropes with their own solvers and their own weights, etc. - no errors whatsoever).
Now I'm trying to change it so that there's only 1 rope at a time. When the player character fires another arrow at the ceiling, I want it to destroy the previous rope and then just make a new one in the new location. I'm using Unity's standard Destroy() method to destroy the rope parent (which has the solver and updater attached to it, then the rope itself which is a child, and the weight which is a separate object that's a child of the rope). Deleting the object throws no errors by itself. However, when I then go to shoot a new arrow to spawn a new rope, Unity starts throwing endless errors, which pertain to the Rigidbody of the weight object.
I'm assuming from the errors that the Obi code somewhere is trying to access/update the rigidbody that was attached to the weight at the bottom of the original rope, which has since been destroyed and no longer exists. Is there something I need to call first before destroying the rope, solver, and rigidbody so I can spawn the new rope without errors?
If I delete the old rope except for the weight with the rigidbody, then there are no errors. It's only when I delete the weight that it throws errors when I try to spawn a new rope. I'm assuming Obi has an internal list of rigidbodies it's trying to update when the new rope tries to spawn and I'm destroying them improperly.
Thank you in advance for your assistance.
I have the rope set up in such a way where one spawns after the player character fires a bow at the ceiling, and when the arrow hits the ceiling, a rope extends downward, so that the character can climb up it. When the arrow hits the ceiling, everything spawns (solver, updater, renderer, etc.), along with a weight at the bottom of the rope so that the rope is always calm and held down as it gradually extends towards the ground. Everything works great and looks really good. Also I can do this pretty much as many times as I want (i.e. fire a bunch of arrows at the ceiling, one after another, and all of them spawn their own ropes with their own solvers and their own weights, etc. - no errors whatsoever).
Now I'm trying to change it so that there's only 1 rope at a time. When the player character fires another arrow at the ceiling, I want it to destroy the previous rope and then just make a new one in the new location. I'm using Unity's standard Destroy() method to destroy the rope parent (which has the solver and updater attached to it, then the rope itself which is a child, and the weight which is a separate object that's a child of the rope). Deleting the object throws no errors by itself. However, when I then go to shoot a new arrow to spawn a new rope, Unity starts throwing endless errors, which pertain to the Rigidbody of the weight object.
I'm assuming from the errors that the Obi code somewhere is trying to access/update the rigidbody that was attached to the weight at the bottom of the original rope, which has since been destroyed and no longer exists. Is there something I need to call first before destroying the rope, solver, and rigidbody so I can spawn the new rope without errors?
If I delete the old rope except for the weight with the rigidbody, then there are no errors. It's only when I delete the weight that it throws errors when I try to spawn a new rope. I'm assuming Obi has an internal list of rigidbodies it's trying to update when the new rope tries to spawn and I'm destroying them improperly.
Thank you in advance for your assistance.