Removed some mf new
This commit is contained in:
parent
58df25c392
commit
61dbace099
|
@ -362,11 +362,6 @@ void API_Impl::ReleaseFromLimbo( const ICustomBody* objRef )
|
|||
|
||||
void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void* args, EventAction_ApplyEffect effect)
|
||||
{
|
||||
btRigidBody* body;
|
||||
btCollisionShape* shape;
|
||||
btMotionState* state;
|
||||
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI(0, NULL, NULL);
|
||||
|
||||
Sphere* sphere;
|
||||
Box* box;
|
||||
Cone* cone;
|
||||
|
@ -374,59 +369,61 @@ void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void*
|
|||
switch(collideable->type)
|
||||
{
|
||||
case ICollideable::Type::Type_sphere:
|
||||
{
|
||||
sphere = dynamic_cast<Sphere*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btSphereShape(sphere->radius);
|
||||
btSphereShape btSphere(sphere->radius);
|
||||
|
||||
// Add motion state
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f),btVector3(sphere->center.x, sphere->center.y, sphere->center.z)));
|
||||
btDefaultMotionState state = btDefaultMotionState(btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f),btVector3(sphere->center.x, sphere->center.y, sphere->center.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, state, shape);
|
||||
body = new btRigidBody(rigidBodyCI);
|
||||
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, &state, &btSphere);
|
||||
btRigidBody body = btRigidBody(rigidBodyCI);
|
||||
|
||||
ContactSensorCallback callback(body, effect, args);
|
||||
this->dynamicsWorld->contactTest(&body, callback);
|
||||
}
|
||||
break;
|
||||
|
||||
case ICollideable::Type::Type_box:
|
||||
{
|
||||
box = dynamic_cast<Box*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btBoxShape(btVector3(box->boundingOffset.x, box->boundingOffset.y, box->boundingOffset.z));
|
||||
btBoxShape btBox = btBoxShape(btVector3(box->boundingOffset.x, box->boundingOffset.y, box->boundingOffset.z));
|
||||
|
||||
// Add motion state
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f),btVector3(box->center.x, box->center.y, box->center.z)));
|
||||
btDefaultMotionState state = btDefaultMotionState(btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f),btVector3(box->center.x, box->center.y, box->center.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, state, shape);
|
||||
body = new btRigidBody(rigidBodyCI);
|
||||
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, &state, &btBox);
|
||||
btRigidBody body = btRigidBody(rigidBodyCI);
|
||||
|
||||
ContactSensorCallback callback(body, effect, args);
|
||||
this->dynamicsWorld->contactTest(&body, callback);
|
||||
}
|
||||
break;
|
||||
|
||||
case ICollideable::Type::Type_cone:
|
||||
{
|
||||
cone = dynamic_cast<Cone*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btConeShapeZ(cone->radius, cone->length);
|
||||
btConeShapeZ coneShape = btConeShapeZ(cone->radius, cone->length);
|
||||
|
||||
// Add motion state
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(cone->quaternion.x, cone->quaternion.y, cone->quaternion.z, cone->quaternion.w),btVector3(cone->center.x, cone->center.y, cone->center.z)));
|
||||
btDefaultMotionState state = btDefaultMotionState(btTransform(btQuaternion(cone->quaternion.x, cone->quaternion.y, cone->quaternion.z, cone->quaternion.w),btVector3(cone->center.x, cone->center.y, cone->center.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, state, shape);
|
||||
body = new btRigidBody(rigidBodyCI);
|
||||
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, &state, &coneShape);
|
||||
btRigidBody body = btRigidBody(rigidBodyCI);
|
||||
|
||||
ContactSensorCallback callback(body, effect, args);
|
||||
this->dynamicsWorld->contactTest(&body, callback);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
ContactSensorCallback callback(*body, effect, args);
|
||||
|
||||
this->dynamicsWorld->contactTest(body, callback);
|
||||
|
||||
delete state;
|
||||
state = NULL;
|
||||
delete shape;
|
||||
shape = NULL;
|
||||
delete body;
|
||||
body = NULL;
|
||||
}
|
||||
|
||||
namespace Oyster
|
||||
|
|
Loading…
Reference in New Issue