Array out of index with NarrowPhaseSystems

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Juzzaga
Posts: 2
Joined: Sun Jan 06, 2019 7:39 pm

Array out of index with NarrowPhaseSystems

Post by Juzzaga » Mon Jan 14, 2019 7:28 pm

Hi,

I`m getting array out of index in BEPUutilities.DataStructures.RawList<BEPUphysics.NarrowPhaseSystems.Pairs.NarrowPhasePair>.FastRemoveAt(int index) when adding box to physics scene in bepu 1. It happens when I receive command from server that I execute.
I tried to use Space.SpaceObjectBuffer but it didn't help as I thought it might be because of bepu is currently running.

Code: Select all

 
 	/// <summary>
        /// Removes an element from the list without maintaining order.
        /// </summary>
        /// <param name="index">Index of the element to remove.</param>
        public void FastRemoveAt(int index)
        {
            if (index >= Count)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            Count--;
            if (index < Count)
            {
                Elements[index] = Elements[Count];
            }
            Elements[Count] = default(T);

        }
My update code is very simple. It's like this - where all the computation and added objects should be run before physics update. Any ideas?

Code: Select all

    
    public void StepForward(float dt)
    {
        tickSystem.Run();

        physicsScene.Update();
    }
Edit: Oh yeah and I´m running on .net core 2.1 - can BEPU 1 run on it? I thought I saw release that supports at least .NET Standard 2.0..?

Norbo
Site Admin
Posts: 4664
Joined: Tue Jul 04, 2006 4:45 am

Re: Array out of index with NarrowPhaseSystems

Post by Norbo » Mon Jan 14, 2019 10:54 pm

That error does indeed look like something I'd expect from asynchronous modification. If it is, I won't be able to easily point out the problem. If you fully sequentialize execution to guarantee no asynchronous access of any kind, does it still happen?
Edit: Oh yeah and I´m running on .net core 2.1 - can BEPU 1 run on it? I thought I saw release that supports at least .NET Standard 2.0..?
Should be fine, yes- v1.5.1 moved to standard 2.0, which is implemented by core 2.1.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests