Shape automatically as big as entity

spacegaier

12-10-2008 19:03:06

Is there a way to tell a NxOgre actor's shape to be automatically as big as the Ogre entity? Would came in pretty handy.

If it is not implemented yet, is there a change, betajaen, that it will be?

betajaen

12-10-2008 19:04:26

It would be difficult to do, not only that it doesn't really fit in the whole "Rendersystem should be seperate from NxOgre thing".

spacegaier

12-10-2008 19:16:03

Okay, if not implement it then please give me a hint how to realize this the best.

I haven't found a method to retrieve neither the original size of an entity (or its mesh) which I could mulpitly with the applied scalefactors nor the current size. Any ideas?

betajaen

12-10-2008 19:33:58

AABB bounding box is probably the easiest.

spacegaier

12-10-2008 19:56:28

And what was the relation between Ogre and NxOgre units? 1 Ogre unit = how many NxOgre units?

betajaen

12-10-2008 20:16:54

Same.

But in NxOgre we use SI units so, one unit is a metre.

spacegaier

12-10-2008 20:32:15

That is strange then. Because I did the following:

Ogre::AxisAlignedBox aabb = E->getBoundingBox();
Vector3 mySize = aabb.getSize();


E is my Entity and I just looked up its size. Then I created an actor with the size of mySize and it was far to big, more exactly by the factor of ten. So, mySize * 0.1 results in the right size.

Wouldn't that mean 1 Ogre unit = 10 NxOgre units?

betajaen

12-10-2008 20:36:57

No, your bounding box is wrong.

1 unit = 1 NxOgre unit = 1metre.
Vector3(1,1,1) = NxVec3(1,1,1)

I don't do anything to position, scale or anything - because it would be to expensive (processor time wise) to do so.

spacegaier

12-10-2008 20:43:05

:oops: :x :oops: How embarrassing...
I've taken the wrong entity to get the size (and this other entity was ten times bigger).

mcaden

13-10-2008 00:11:37


Ogre::AxisAlignedBox meshBounds = mesh->getBoundingBox();
Shape* collisionShape = new Cube( meshBounds.getSize() );


That should do it.

Prophet

13-10-2008 06:23:01

Ogre::Entity::GetBoundingRadius can also be used if you're using a cube/sphere.

spacegaier

13-10-2008 07:56:05

Yes, I've solved it already. Thanks however guys.

In fact I did not use the mesh for retrieving the size but the entity, but that results in the same.

mcaden

13-10-2008 10:40:03

mesh in that instance is an Entity*