|
|
|
@ -28,7 +28,7 @@ namespace Physic
|
|
|
|
|
mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation, true);
|
|
|
|
|
Ogre::Quaternion inverse = mBoxRotation.Inverse();
|
|
|
|
|
mBoxRotationInverse = btQuaternion(inverse.x, inverse.y, inverse.z,inverse.w);
|
|
|
|
|
//mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
|
|
|
|
|
mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PhysicActor::~PhysicActor()
|
|
|
|
@ -109,7 +109,7 @@ namespace Physic
|
|
|
|
|
//Create the newly scaled rigid body
|
|
|
|
|
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, pos, rot);
|
|
|
|
|
mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, pos, rot, 0, 0, true);
|
|
|
|
|
mEngine->addRigidBody(mBody, false, mRaycastingBody); //Add rigid body to dynamics world, but do not add to object map
|
|
|
|
|
mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ogre::Vector3 PhysicActor::getHalfExtents() const
|
|
|
|
@ -331,8 +331,8 @@ namespace Physic
|
|
|
|
|
|
|
|
|
|
mHeightFieldMap [name] = hf;
|
|
|
|
|
|
|
|
|
|
dynamicsWorld->addRigidBody(body,CollisionType_World|CollisionType_Raycasting,
|
|
|
|
|
CollisionType_World|CollisionType_ActorInternal|CollisionType_ActorExternal|CollisionType_Raycasting);
|
|
|
|
|
dynamicsWorld->addRigidBody(body,CollisionType_HeightMap|CollisionType_Raycasting,
|
|
|
|
|
CollisionType_World|CollisionType_Actor|CollisionType_Raycasting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PhysicEngine::removeHeightField(int x, int y)
|
|
|
|
@ -430,8 +430,8 @@ namespace Physic
|
|
|
|
|
const std::string& name = (body ? body->mName : raycastingBody->mName);
|
|
|
|
|
|
|
|
|
|
if (body){
|
|
|
|
|
if(actor) {dynamicsWorld->addRigidBody(body,CollisionType_ActorInternal,CollisionType_World|CollisionType_ActorInternal);std::cout << "actor";}
|
|
|
|
|
else dynamicsWorld->addRigidBody(body,CollisionType_World,CollisionType_World|CollisionType_ActorInternal|CollisionType_ActorExternal);
|
|
|
|
|
if(actor) dynamicsWorld->addRigidBody(body,CollisionType_Actor,CollisionType_World|CollisionType_HeightMap);
|
|
|
|
|
else dynamicsWorld->addRigidBody(body,CollisionType_World,CollisionType_World|CollisionType_Actor|CollisionType_HeightMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (raycastingBody)
|
|
|
|
@ -613,7 +613,7 @@ namespace Physic
|
|
|
|
|
float d1 = 10000.;
|
|
|
|
|
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
|
|
|
|
|
if(raycastingObjectOnly) resultCallback1.m_collisionFilterMask = CollisionType_Raycasting;
|
|
|
|
|
else resultCallback1.m_collisionFilterMask = CollisionType_ActorExternal;
|
|
|
|
|
else resultCallback1.m_collisionFilterMask = CollisionType_World;
|
|
|
|
|
dynamicsWorld->rayTest(from, to, resultCallback1);
|
|
|
|
|
if (resultCallback1.hasHit())
|
|
|
|
|
{
|
|
|
|
@ -644,7 +644,7 @@ namespace Physic
|
|
|
|
|
std::pair<bool, float> PhysicEngine::sphereCast (float radius, btVector3& from, btVector3& to)
|
|
|
|
|
{
|
|
|
|
|
OurClosestConvexResultCallback callback(from, to);
|
|
|
|
|
callback.m_collisionFilterMask = OEngine::Physic::CollisionType_World;
|
|
|
|
|
callback.m_collisionFilterMask = OEngine::Physic::CollisionType_World|OEngine::Physic::CollisionType_HeightMap;
|
|
|
|
|
|
|
|
|
|
btSphereShape shape(radius);
|
|
|
|
|
const btQuaternion btrot(0.0f, 0.0f, 0.0f);
|
|
|
|
|