About Store Forum Documentation Contact
Donations:
207$/mo



Post Reply 
Physics.ray() Thread Safe
Author Message
fatcoder Offline
Member

Post: #1
Physics.ray() Thread Safe
Any chance of making Physics.ray() thread safe? I have to use it on a separate background thread as I'm calling it many times a second, so too much for the main thread. The problem is that sometimes it will randomly crash. I can only assume that it must be trying to cast a ray while the physics simulation is being updated.

When calling Physics.ray(), would it be possible to make the function just wait until the physics simulation update is finished, if it is being updated?
02-24-2013 03:55 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Physics.ray() Thread Safe
Physics.ray is just a call to raycastClosestShape/raycastAllShapes on physx 2
and raycastSingle/raycastAny/raycastMultiple on physx 3
you can read more about their thread safety in physx docs

Quote:When calling Physics.ray(), would it be possible to make the function just wait until the physics simulation update is finished, if it is being updated?
That would need to be manually taken care of
02-24-2013 01:32 PM
Find all posts by this user Quote this message in a reply
Post Reply