Page 1 of 1

Multithreaded RayCast Issue

Posted: Sun May 29, 2011 5:52 am
by Bonus
I've developed miltithreaded game engine using BEPU. It's works fine, but sometimes BEPU crashes in "internal void RayCast(ref Ray ray, IList<BroadPhaseEntry> outEntries)" in DynamicHierarchyNode.cs with "Collection was modified; enumeration operation may not execute."
RayCast called from worker thread.

Re: Multithreaded RayCast Issue

Posted: Sun May 29, 2011 1:15 pm
by Norbo
Is it running in parallel with the physics update? The broad phase update will interfere with any queries going on at the time, so it's not allowed. All BroadPhases expose a Locker property which is held when the BroadPhase updates. You can lock it before performing a raycast to ensure that it won't get corrupted.

Re: Multithreaded RayCast Issue

Posted: Sun May 29, 2011 4:41 pm
by Bonus
Norbo wrote:Is it running in parallel with the physics update?
yes
Norbo wrote:You can lock it before performing a raycast to ensure that it won't get corrupted.
Thanks! It's works.