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)
|
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;
|
Sphere* sphere;
|
||||||
Box* box;
|
Box* box;
|
||||||
Cone* cone;
|
Cone* cone;
|
||||||
|
@ -374,59 +369,61 @@ void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void*
|
||||||
switch(collideable->type)
|
switch(collideable->type)
|
||||||
{
|
{
|
||||||
case ICollideable::Type::Type_sphere:
|
case ICollideable::Type::Type_sphere:
|
||||||
|
{
|
||||||
sphere = dynamic_cast<Sphere*>(collideable);
|
sphere = dynamic_cast<Sphere*>(collideable);
|
||||||
// Add collision shape
|
// Add collision shape
|
||||||
shape = new btSphereShape(sphere->radius);
|
btSphereShape btSphere(sphere->radius);
|
||||||
|
|
||||||
// Add motion state
|
// 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
|
// Add rigid body
|
||||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, state, shape);
|
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, &state, &btSphere);
|
||||||
body = new btRigidBody(rigidBodyCI);
|
btRigidBody body = btRigidBody(rigidBodyCI);
|
||||||
|
|
||||||
|
ContactSensorCallback callback(body, effect, args);
|
||||||
|
this->dynamicsWorld->contactTest(&body, callback);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICollideable::Type::Type_box:
|
case ICollideable::Type::Type_box:
|
||||||
|
{
|
||||||
box = dynamic_cast<Box*>(collideable);
|
box = dynamic_cast<Box*>(collideable);
|
||||||
// Add collision shape
|
// 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
|
// 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
|
// Add rigid body
|
||||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, state, shape);
|
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, &state, &btBox);
|
||||||
body = new btRigidBody(rigidBodyCI);
|
btRigidBody body = btRigidBody(rigidBodyCI);
|
||||||
|
|
||||||
|
ContactSensorCallback callback(body, effect, args);
|
||||||
|
this->dynamicsWorld->contactTest(&body, callback);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICollideable::Type::Type_cone:
|
case ICollideable::Type::Type_cone:
|
||||||
|
{
|
||||||
cone = dynamic_cast<Cone*>(collideable);
|
cone = dynamic_cast<Cone*>(collideable);
|
||||||
// Add collision shape
|
// Add collision shape
|
||||||
shape = new btConeShapeZ(cone->radius, cone->length);
|
btConeShapeZ coneShape = btConeShapeZ(cone->radius, cone->length);
|
||||||
|
|
||||||
// Add motion state
|
// 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
|
// Add rigid body
|
||||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, state, shape);
|
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, &state, &coneShape);
|
||||||
body = new btRigidBody(rigidBodyCI);
|
btRigidBody body = btRigidBody(rigidBodyCI);
|
||||||
|
|
||||||
|
ContactSensorCallback callback(body, effect, args);
|
||||||
|
this->dynamicsWorld->contactTest(&body, callback);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
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
|
namespace Oyster
|
||||||
|
|
Loading…
Reference in New Issue