示例#1
0
void loadRootCollisionNode(Niflib::RootCollisionNodeRef node, RefMap& refmap)
{
	//TODO: memory management with compound shapes?
	//keep track of subshapes so we can delete them later
	btCompoundShape *shape = new btCompoundShape();

	auto children = node->GetChildren();
	for (auto& child: children) {
		if (child->GetType().IsSameType(Niflib::NiTriShape::TYPE)) {
			Niflib::NiTriShapeRef trishape = Niflib::DynamicCast<Niflib::NiTriShape>(child);

			btCollisionShape *subshape = loadCollisionMesh(trishape);
			shape->addChildShape(getBtNodeTransform(trishape), subshape);
		}
	}

	refmap.currentModel->setShape(shape);
}
示例#2
0
gep::IShape* gep::HavokPhysicsFactory::loadCollisionMeshFromLua(const char* path)
{
    auto pResult = loadCollisionMesh(path).get()->getShape();
    return postProcessNewShape(pResult);
}