|
|
|
@ -256,7 +256,7 @@ namespace MWWorld
|
|
|
|
|
return mEngine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<float, std::string> PhysicsSystem::getFacedHandle (MWWorld::World& world, float queryDistance)
|
|
|
|
|
std::pair<float, std::string> PhysicsSystem::getFacedHandle(float queryDistance)
|
|
|
|
|
{
|
|
|
|
|
Ray ray = mRender.getCamera()->getCameraToViewportRay(0.5, 0.5);
|
|
|
|
|
|
|
|
|
@ -266,8 +266,7 @@ namespace MWWorld
|
|
|
|
|
btVector3 dir(dir_.x, dir_.y, dir_.z);
|
|
|
|
|
|
|
|
|
|
btVector3 dest = origin + dir * queryDistance;
|
|
|
|
|
std::pair <std::string, float> result;
|
|
|
|
|
/*auto*/ result = mEngine->rayTest(origin, dest);
|
|
|
|
|
std::pair <std::string, float> result = mEngine->rayTest(origin, dest);
|
|
|
|
|
result.second *= queryDistance;
|
|
|
|
|
|
|
|
|
|
return std::make_pair (result.second, result.first);
|
|
|
|
@ -338,24 +337,6 @@ namespace MWWorld
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btVector3 PhysicsSystem::getRayPoint(float extent)
|
|
|
|
|
{
|
|
|
|
|
//get a ray pointing to the center of the viewport
|
|
|
|
|
Ray centerRay = mRender.getCamera()->getCameraToViewportRay(
|
|
|
|
|
mRender.getViewport()->getWidth()/2,
|
|
|
|
|
mRender.getViewport()->getHeight()/2);
|
|
|
|
|
btVector3 result(centerRay.getPoint(extent).x,centerRay.getPoint(extent).y,centerRay.getPoint(extent).z);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
btVector3 PhysicsSystem::getRayPoint(float extent, float mouseX, float mouseY)
|
|
|
|
|
{
|
|
|
|
|
//get a ray pointing to the center of the viewport
|
|
|
|
|
Ray centerRay = mRender.getCamera()->getCameraToViewportRay(mouseX, mouseY);
|
|
|
|
|
btVector3 result(centerRay.getPoint(extent).x,centerRay.getPoint(extent).y,centerRay.getPoint(extent).z);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PhysicsSystem::castRay(const Vector3& from, const Vector3& to, bool raycastingObjectOnly,bool ignoreHeightMap)
|
|
|
|
|
{
|
|
|
|
|
btVector3 _from, _to;
|
|
|
|
|