I’m facing an issue with removing a model and its collider in my (r3f) scene.
When I add a model, I store its information in an array. Essentially, when I place a model in the scene, I push its details into this array. Similarly, when I want to remove a model, I remove its corresponding element from the array and trigger a re-render to update the scene with the remaining models.
However, I’m encountering a problem: while the model itself gets removed as expected, its collider does not. Instead, the collider of the most recently added model gets removed. In other words, colliders are being removed in the order that the models were last placed, not corresponding to the model I intended to delete.
If anyone has any thoughts or suggestions on how to resolve this, I would really appreciate your input. Thank you in advance!
As I recall, add or update physics body uses a deep copy, or form of clone within wasm. Additionally, there are subroutines with access.
As I recall, one needs exposure to inner variables or functions. Wasm has pre- and post- configurations for these, if you choose to compile yourself. If prescribed use is your goal.
Generally speaking, no; without – a specific problem – or infographics fundamental to OP’s request nature. You may supplant the r3f/jobs hashtag to expedite a(n) issue. I personally struggled with an identical issue with ammo (WASM aside).
I liken WASM modules to a private conversation. The ongoing process is expected… albeit with multivariate internal events. I traced a “lost pointer” to private scope and the reserved structure of WASM memory. The shape of your problem reminds me of some personal experience with a specialized math library.
I experimented with different libraries for APIs, and used pre-run/post-run in WASM cfg to access lower internals. I don’t know if you use WASM, but thank you for entertaining me.
Thank you for your offer. I am using in rapier physic engine. What is your opinion in this case?
In fact, your advise is really value for me. Thank you.
Regrettably, I have extensive commitments with an “unnamed private corporation”. When we first met, I was determined to implore you:
for the sake of error within (or without) a sub loop
(As for the simple API of Rapier, I recall only a dozen of the numerous core methods were exposed. The state of documentation may attest to that. Inspect Rapier (or Physii…) from Google’s dev console (unless discontinued…) to explore “unnamed private functions”.)
a heavy thread (init, render…) can cause a passed reference to have unexpected values. That is, mutability or asynchronous.
Thank you for your input. I’ve attached a video captcha file that shows the details. I really appreciate the sample you provided, and I would love for you to give me a more polished version.
Fundamentally impossible to prove from the video, since order of operations is unknown. Yet the details resemble an off-by-one bug. For example, did you reference count instead of array.length? Or overwrite a shared/reused variable which may leak from scope? A quick test would be to subtract one (or fiddle with a 3rd variable).
Fundamentally, I see no obstacle in re-building the scene or using another library. What does a physical interaction comprise? Is InstancedMesh the culprit, versus standard Mesh (again with internal “count” bug(s))?
I ask without personal incrimination. Again, I have polished multiple paths forward with foundational personal testimony.
Sorry to hear your input, but I can consider if you are willing to provide as well.
One thing I am focusing is to implement collider to whole my project and I have already tried with bounding box. Bounding box generate so many logic problem with complexation of its usage.
If you have any ideas, please contact to me. Thank you!