Bounding box intersect.

feanor91

14-11-2008 12:37:36

Hi

I Want to test intersection of 2 bounding box to determine if an objet is in or out another; and I want that my first objetc be out the second so I make this :

CVNode.SetPosition(0, 0, 0)
BoundingBoxCV = CVEntity.BoundingBox
BoundingBoxSol = SolEntity.BoundingBox
CVNode.ShowBoundingBox = True
SolNode.ShowBoundingBox = True
myOgre.OgreUpdate()
Dim y As Integer = 0
While BoundingBoxCV.Intersects(BoundingBoxSol)
y -= 1
CVNode.SetPosition(0, 0, y)
myOgre.OgreUpdate()
End While

Return y


I see the "CV" getting out the "Sol" but it didn't stop when it's bounding box is out of "sol" so BoundingBoxCV.Intersects(BoundingBoxSol)

return always true...WHY?

Therefore my bounding box is bigger than my object. Another time WHY?

AndroidAdam

14-11-2008 18:57:22

I've had this problem before. Trying to check if my entity's bounding boxes were intersecting. Rather than using the Entity's bounding box, do this:

BoundingBoxSol = SolEntity.ParentSceneNode._getWorldAABB()
and check collision using that.

feanor91

14-11-2008 21:14:18

Hi

Trying this :

BoundingBoxCV = CVEntity.ParentSceneNode._getWorldAABB()
BoundingBoxSol = SolEntity.ParentSceneNode._getWorldAABB()
CVNode.ShowBoundingBox = True
SolNode.ShowBoundingBox = True
myOgre.OgreUpdate()
Dim y As Integer = 0
While BoundingBoxCV.Intersects(BoundingBoxSol)
y -= 1
CVNode.SetPosition(0, 0, y)
myOgre.OgreUpdate()
End While


Same results....

Trying that :

BoundingBoxCV = CVEntity.BoundingBox()
BoundingBoxSol = SolEntity.ParentSceneNode._getWorldAABB()
CVNode.ShowBoundingBox = True
SolNode.ShowBoundingBox = True
myOgre.OgreUpdate()
Dim y As Integer = 0
While BoundingBoxCV.Intersects(BoundingBoxSol)
y -= 1
CVNode.SetPosition(0, 0, y)
myOgre.OgreUpdate()
End While


Same result too

Beauty

12-12-2008 11:46:34

If the SceneNode is attached to the RootSceneNode than I suppose myNode.ParentSceneNode._getWorldAABB() is the AABB of the whole world. Maybe this is the problem?

There is an option to show all the AABBs. Try to switch them on. It could help for searching the problem.

feanor91

12-12-2008 14:49:55

Hi

I forget about this thread, but I solved the problem by using spheres placing in interest points of my kites and for each position where my kite could be in contact with the ground, I compute the lowest sphere, then moving the kite up or down and testing altitude of the sphere to see if it's on ground or not. When she is, i return kite altitude. As I compute my animation before playing it, it works fine, but this solution will not be usable if I have to compute when animating.

Playing with bounding box didn't work because its AAb so the box could be greater than kite...Too bad. I see that with the latest version of ogrenewt, we can move body without force, so I can test with this in a future (very future...) version. My test with my version of ogrenewt is good bu I use forces so when the kit hits the ground, it start to bump as a balloon so it's not the behaviour that I want, but it opens some new and interesting perspectives....

Beauty

12-12-2008 15:57:38

Generally you can use collision detection with Newton. But if you use it without physics, than you'll get in trouble. There is no collision checking until one of the colliding was moved by physics.

In the next weeks or months Newton 2.0 will be released. There are nice improvements that will solve this problems.
If you want to know when it will be released, just enable the watch option at this thread.