Problem with the Ocean example

westpointer

10-09-2008 16:26:52

I downloaded the Ocean example from Ofusion website.
Then, I loaded it in Ogre. But I find that the ocean disapears when I
rotate the camera. So I modified my code:

Ogre::AxisAlignedBox AABInf;
AABInf.setInfinite();
mSceneMgr->getEntity("WaterPlane")->getMesh()->_setBounds(AABInf);

But it takes no effect, and the problem remains.
What should I do to solve this problem.

Lioric

11-09-2008 05:08:09

You are updating the aabb of the mesh (that will be used when you create a new entity based on that mesh), you need th update the aabb of the entity (it has its own bounding box)

westpointer

11-09-2008 10:17:16

You are updating the aabb of the mesh (that will be used when you create a new entity based on that mesh), you need th update the aabb of the entity (it has its own bounding box)

I revise my code to the following:

AxisAlignedBox AAB = mSceneMgr->getEntity("WaterPlane")->getChildObjectsBoundingBox();
AAB.setInfinite();

But it still has no effect?

Lioric

13-09-2008 03:06:31

Because you are working on a copy of the aabb object (and because that method is not for the entity aabb)

As in the latest Ogre versions, the entity (movable object) aabb methods are const you cant change it by directly using the aabb

Use this:

Create a 'manual object' (from the scene manager)
set the aabb of this object to INFINITE
attach this object to the parent scene node of the water plane

westpointer

13-09-2008 09:54:54

I create a 'manual object' (from the scene manager).
But it seems that I cant find a method of Ogre::MovableObject that I can used to set the aabb of this 'manual object' to INFINITE ?

Lioric

13-09-2008 16:40:12

Use 'ManualObject::setBoundingBox' method

westpointer

14-09-2008 02:58:54

The problem is solved. Thanks! :D

westpointer

14-09-2008 15:24:24

There is still a question:Does the INFINITE 'manual object' affect the AABB of the child scene node's AABB? What's the AxisAlignedBox relationship between parent scenenode and child scenenode. And what's the AxisAlignedBox relationship between Entiy and the scenenode which the entity attaches to?
I lookup the OGRE documentation, but not find the answer!

westpointer

17-09-2008 04:19:04

Nobody knows the answer of my question?

Lioric

17-09-2008 16:27:28

Scene nodes do not have a defined AABB, it is recalculated every time a change is made in its attached objects (see the _update method of the scene node), its AABB is the result of the merge of all of the bounding boxes of the attached objects, and child nodes (and their attached objects AABB)

A bounding box of a entitiy (or manual object) do not affect other's AABB, the parent scene node just merges this with the other attahced objects when the needed to mantain a 'Scene Node AABB'

westpointer

19-09-2008 02:51:43

I get it. Thanks a lot.