How determine if a node is inside other?


Sorry for this newbie question, but I've looked through the forum without finding out the solution.

I just was wondering if there is a simple way to know if a node is COMPLETELY inside another. I guess there must be some check concerning bounding volumes to get so, but I did not find it (boundingVoulme.intersects(otherVolume) is not what I'm looking for)

Thank you in advance

You can check if the boundingVolume contains a vector

abstract  boolean    contains(Vector3f point)
          determines if a given point is contained within this bounding volume.

All right, may be checking all four vertex of the bounding box…

Thanks, I know it was a stupid question!


It isn't stupid and I don't know if there is a better way, but if you are using bounding boxes, it should be fine. Anything else would require some … thought as to the implementation. But, yes, just using vectors will work even if it is another shape, it will just take longer.

Not sure what the case is, but using collision detection before checking for inclusion would help if it is a larger number of cases. If object A is inside object B, I would guess that they are in a collision state. If not in a collision state, then inclusion would be improbable (unless the object is hollow…which would introduce a new level of complication). If you are just testing 2 objects only (A inside B) then optimization shouldn't be a huge deal.