Collision detection outside BGE

Hi there,
as part of my bachelor thesis I have to simulate an 6-axis industrial robot. The movements are read out of an separated file and converted into a keyframe animation. This works quite well. Next part is to detect if there are collision of the robot with any surrounding object. The point is, that I don’t want to start the BGE because the detection should be started from a button without additional action of the user. Has someone an idea how to detect collisions outside the BGE? Or if there is no way outside the BGE than how to start the BGE and detect for collisions without waiting for the hole animation to finish?

I would be very happy for every help

Sounds like you might be needing to implement your own collision detection system.

If so, you should read up on the Separating Axis Theorem.

In a nutshell, to check if two CONVEX solids overlap…

  1. Assume they DO overlap, and perform the following checks to see if they DON’T.
  2. Compare the bounding boxes of both sets of vertices to see if there are any gaps between the boxes on the X, Y, or Z axes. If there are gaps, exit early.
  3. For every triangle in the meshes: project both mesh’s vertices along that triangle’s normal vector, and compare the resulting vertex sets to see if a gap appears. Again, just exit as soon as you find a gap.
  4. For every pair of triangles in the meshes: project both mesh’s vertices along the cross product of the two normal vectors and check for gaps.
  5. If you get here and still haven’t found a gap, they’re intersecting.

This method ONLY works for CONVEX solids, not regular triangle meshes. If you want to check collision between triangle meshes, you’ll have to check every triangle of mesh A against every triangle of mesh B for intersections.

I already thought to start using a simple AABB vs AABB collision detection but thats a lot of work and I’m not sure if I can get this to the needed speed and accuracy in python. Would be very sad to spent so much effort and time if there are easier ways possible in blender. The Rigid Body Simulation has already such a nice collision detection Isn’t there a way to use this?


The convex_sweep_test sounds like it is useable?

Oh wow, didn’t even know that was in there! Yea that’ll probably work for you.