changing world size

changing world size

Hi,
Is there a way to change the world size (i.e. broadphase size) after its creation?
I want to be able to load more .hkx file during the game and to make sure all rigidbodies stays inside the world (by changing the world size to include them).

Thanks,
Yinon

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Yinon,

There is no way to do this at present. You can make a new world with a bigger AABB on demand:

What you could do is calc the size of the AABB of the shape you want to add.

(I'm writing code off the top of my head here)

hkAabb aabb;

rigidbody->getCollidable()->getShape->calcAabb(rigidBody->getTransform() , aabb);

hkAabb bp = pWorld->getBroadphaseExtents();

bp.includePoint(aabb.m_min);

bp.includePoint(aabb.m_max);

hkpPhysicsSystem system = pWorld->getWorldAsOneSystem();

pworld->removeReference();

pWorld = new hkpWorld();

pworld->addPhysicsSystem(system);

pworld->addEntity(rigidBody);

you will need to also account for any listeners that you had in the old world.

Thanks,

Marc

Leave a Comment

Please sign in to add a comment. Not a member? Join today