Game Development Reference
In-Depth Information
cyclone::RigidBody tempBody;
tempBody.setPosition(body->getPosition());
tempBody.setOrientation(body->getOrientation());
tempBody.setVelocity(body->getVelocity());
tempBody.setRotation(body->getRotation());
tempBody.setLinearDamping(body->getLinearDamping());
tempBody.setAngularDamping(body->getAngularDamping());
tempBody.setInverseInertiaTensor(body->getInverseInertiaTensor());
tempBody.calculateDerivedData();
// Remove the old block.
target->exists = false;
// Work out the inverse density of the old block.
cyclone::real invDensity =
halfSize.magnitude()*8 * body->getInverseMass();
// Now split the block into eight.
for (unsigned i = 0;i<8;i++)
{
// Find the minimum and maximum extents of the new block
// in old-block coordinates.
cyclone::Vector3 min, max;
if ((i & 1) == 0) {
min.x = -size.x;
max.x = point.x;
} else {
min.x = point.x;
max.x = size.x;
}
if ((i & 2) == 0) {
min.y = -size.y;
max.y = point.y;
} else {
min.y = point.y;
max.y = size.y;
}
if ((i & 4) == 0) {
min.z = -size.z;
max.z = point.z;
} else {
min.z = point.z;
max.z = size.z;
}
Search Nedrilad ::




Custom Search