I got this function,
/// Physics. Called once to setup physics of this entity.void ModelEntity::ConfigurePhysics(){ neV3 box; neV3 pos; // Configure this model's physics and add it into the physics engine's list. rig = engine->GetPhysicsHandler()->GetSimulator()->CreateRigidBody(); // Add geometry to the rigid body. ( A box in our case ) geom = rig->AddGeometry(); // Calculate tokamak's bounding box size. box.Set(bbox.GetMax().GetX() + bbox.GetMin().GetX(), bbox.GetMax().GetY() + bbox.GetMin().GetY(), bbox.GetMax().GetZ() + bbox.GetMin().GetZ()); // Update geometry. geom->SetBoxSize(box); rig->UpdateBoundingInfo(); // Set the object's mass. rig->SetInertiaTensor(neBoxInertiaTensor(box[0], box[1], box[2], 1.0f)); rig->SetMass(1.0f); // Set the rig's position. pos.Set(position.GetX(), position.GetY() + 120.0f, position.GetZ()); rig->SetPos(pos);}
Which perfectly positions the model in the air. it slowly falls down the way it should. The only problem here is that it falls through the floor. So I did bounding box + 220 and messed around with the values and I noticed them finally getting stuck in the floor. There for, I think the bounding box calculation is incorrect. Am I doing something wrong here ? Is their box supposed to be the same size in width height and depth ?