little interface improvement

actorid
gus 12 years ago
parent a328a03bd3
commit 603af21715

@ -333,13 +333,13 @@ namespace MWWorld
return result;
}
bool PhysicsSystem::castRay(const Vector3& from, const Vector3& to, bool raycastingObjectOnly)
bool PhysicsSystem::castRay(const Vector3& from, const Vector3& to, bool raycastingObjectOnly,bool ignoreHeightMap)
{
btVector3 _from, _to;
_from = btVector3(from.x, from.y, from.z);
_to = btVector3(to.x, to.y, to.z);
std::pair<std::string, float> result = mEngine->rayTest(_from, _to, raycastingObjectOnly);
std::pair<std::string, float> result = mEngine->rayTest(_from, _to, raycastingObjectOnly,ignoreHeightMap);
return !(result.first == "");
}

@ -63,7 +63,7 @@ namespace MWWorld
// cast ray, return true if it hit something. if raycasringObjectOnlt is set to false, it ignores NPCs and objects with no collisions.
bool castRay(const Ogre::Vector3& from, const Ogre::Vector3& to, bool raycastingObjectOnly = true);
bool castRay(const Ogre::Vector3& from, const Ogre::Vector3& to, bool raycastingObjectOnly = true,bool ignoreHeightMap = false);
std::pair<bool, Ogre::Vector3>
castRay(const Ogre::Vector3 &orig, const Ogre::Vector3 &dir, float len);

@ -1046,7 +1046,7 @@ namespace MWWorld
{
Ogre::Vector3 a(x1,y1,z1);std::cout << x1 << " " << x2;
Ogre::Vector3 b(x2,y2,z2);
return mPhysics->castRay(a,b,false);
return mPhysics->castRay(a,b,false,true);
}
void World::processDoors(float duration)

@ -605,7 +605,7 @@ namespace Physic
{
}
std::pair<std::string,float> PhysicEngine::rayTest(btVector3& from,btVector3& to,bool raycastingObjectOnly)
std::pair<std::string,float> PhysicEngine::rayTest(btVector3& from,btVector3& to,bool raycastingObjectOnly,bool ignoreHeightMap)
{
std::string name = "";
float d = -1;
@ -614,6 +614,8 @@ namespace Physic
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
if(raycastingObjectOnly) resultCallback1.m_collisionFilterMask = CollisionType_Raycasting;
else resultCallback1.m_collisionFilterMask = CollisionType_World;
if(!ignoreHeightMap) resultCallback1.m_collisionFilterMask = resultCallback1.m_collisionFilterMask|| CollisionType_HeightMap;
dynamicsWorld->rayTest(from, to, resultCallback1);
if (resultCallback1.hasHit())
{

@ -293,7 +293,7 @@ namespace Physic
/**
* Return the closest object hit by a ray. If there are no objects, it will return ("",-1).
*/
std::pair<std::string,float> rayTest(btVector3& from,btVector3& to,bool raycastingObjectOnly = true);
std::pair<std::string,float> rayTest(btVector3& from,btVector3& to,bool raycastingObjectOnly = true,bool ignoreHeightMap = false);
/**
* Return all objects hit by a ray.

Loading…
Cancel
Save