imagine creating a small test object that is an Irrlicht sphere and building a physX body to go with it.
Code: Select all
// create an Irrlicht sphere
m_Node = SMGR->addSphereSceneNode(10);
// create a Physx body for it
CreateSphereActor();
void CSObject::CreateSphereActor()
{
if (!m_Node) return;
//How the actor "works"
NxBodyDesc BodyDesc;
BodyDesc.angularDamping = 0.5f; //Will make the body go all gravity on us
// Add a single-shape actor to the scene
NxSphereShapeDesc SphereDesc;
SphereDesc.radius = m_Node->getScale().X;
//General info about the actor.
NxActorDesc BallActorDesc;
BallActorDesc.shapes.pushBack(&SphereDesc);
BallActorDesc.body = &BodyDesc; //Then how he should "work"
BallActorDesc.density = 1.0f; //We give him a density, so he will have a mass.
//And we set him in space somewhere.
vector3df pos = m_Node->getPosition();
BallActorDesc.globalPose.t = NxVec3(pos.X,pos.Y,pos.Z);
//Now we create him!
m_NxActor = m_Level->GetNxScene()->createActor(BallActorDesc);
}
One idea was to destroy the physX object and then recreate it, but you would need to store all of the current 'data' associated with it.
Anyone got any ideas for resizing the object?
Seven