bounding boxes?

yuriythebest

10-02-2008 17:31:32

how do I access the bounding box for a body?

Arcanor

10-02-2008 17:44:54

I've not been able to build the package yet because I'm waiting for Ageia to approve my application.

However... I'll take a shot at answering your question.

I'd take a look at the following: Actor::getCollisionModel()

betajaen

10-02-2008 17:53:45

Both wrong. It's bounding box of the shape.

There is no NxOgre interface for it, but I did write some code in Cake Bleeding that uses the bounding box to move any actor below y, to 0 + half the bounding box height. I'm sure you can extract the code you want from this:

for (Actor* actor = actors->begin(); actor = actors->next();) {
if (actor->isDynamic()) {
if (actor->getGlobalPositionAsNxVec3().y <= 0 ) {
NxVec3 globalPose = actor->getGlobalPositionAsNxVec3();
Shape* s = actor->getCollisionModel().Get(Actor::CollisionModel::First);
NxBounds3 bounds;
s->getNxShape()->getWorldBounds(bounds);
globalPose.y = 0.025f + ((bounds.max.y - bounds.min.y) * 0.5f);
actor->getNxActor()->setGlobalPosition(globalPose);
}
}
}

Arcanor

10-02-2008 18:13:51

Wow, I wasn't totally wrong. :) Your solution code uses actor->getCollisionModel() and finds the bounding box using getWorldBounds(). Cool. 8)

yuriythebest

10-02-2008 18:29:25

cool thanks!