How can I use the new BVH nodes to know if a certain object is inside a volume?
In general if statements are a bit difficult to implement still, but checking wether are a point is inside a volume is (at least partially) possible.

Note: The solution I present here will give 'random' results if the mesh has no volume. Also it doesn't check if the whole object is inside the volume (it only checks the location vector of the object).

The main idea is to take the location of the object and shoot a ray in a random direction. If a polygon in the bvh tree is hit we have to compare the normal of the polygon with the direction of the ray. If the angle between both is lower than 90° we know that the location of the object is inside of the mesh. If it's larger the point is outside.

Let's model this idea with nodes:


Create a new group with the inputs and outputs that you'll need.

Make the shoot a ray in a random direction and calculate the angle between the normal and the ray direction.

Check if the angle is lower than 90°.

Due to the fact that the angle will be zero if the ray doesn't hit any polygon we have to check that both is true: The ray hits a face AND the angle is lower than 90°.



Here is an example on how you can use this group:



ps: For the next release of the Animation Nodes I'll write a node that does the same thing as the group here.