Page 1 of 1

Body set index must be nonnegative and within the sets buffer length.

Posted: Sun Jan 12, 2020 11:23 am
by parapoohda
I try to add trigger as Kinemetic. I think kinemetic is movable and not react to gravity so it seem a good idea.
But I can't seem get it by body handle.

here are my code that remove trigger

Code: Select all

public void RemoveKinemtic(int handle)
        {
                handleKinematicUnits.Remove(handle);
                Simulation.Bodies.Remove(handle);
        }
        
update after allow it to remove once it not error anymore
'

Code: Select all

public void RemoveKinemtic(int handle)
        {
            //System.Threading.Thread.Sleep(10000);
            if (handleKinematicUnits.ContainsKey(handle)) {
                handleKinematicUnits.Remove(handle);
                Simulation.Bodies.Remove(handle);

            }
        }
        

Re: Body set index must be nonnegative and within the sets buffer length.

Posted: Sun Jan 12, 2020 5:50 pm
by Norbo
There's nothing particularly special about kinematic bodies when it comes to addition/removal. Is this removal happening on a different thread than the physics simulation, potentially hitting a race condition?

Re: Body set index must be nonnegative and within the sets buffer length.

Posted: Tue Jan 14, 2020 5:42 am
by parapoohda
I remove it and forget to disable remove. So loop second time it try to remove the one that already remove.