Multithreaded RayCast Issue

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Bonus
Posts: 9
Joined: Mon Mar 21, 2011 2:35 pm

Multithreaded RayCast Issue

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Multithreaded RayCast Issue

Post 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.
Bonus
Posts: 9
Joined: Mon Mar 21, 2011 2:35 pm

Re: Multithreaded RayCast Issue

Post 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.
Post Reply