forked from teamnwah/openmw-tes3coop
Z-up conversion: raycasts
This commit is contained in:
parent
cc9b72b9b1
commit
cd68012498
2 changed files with 11 additions and 14 deletions
|
@ -264,9 +264,8 @@ namespace MWWorld
|
|||
Ogre::Vector3 to = ray.getPoint(queryDistance);
|
||||
|
||||
btVector3 _from, _to;
|
||||
// OGRE to MW coordinates
|
||||
_from = btVector3(from.x, -from.z, from.y);
|
||||
_to = btVector3(to.x, -to.z, to.y);
|
||||
_from = btVector3(from.x, from.y, from.z);
|
||||
_to = btVector3(to.x, to.y, to.z);
|
||||
|
||||
std::vector < std::pair <float, std::string> > results;
|
||||
/* auto */ results = mEngine->rayTest2(_from,_to);
|
||||
|
@ -287,7 +286,7 @@ namespace MWWorld
|
|||
Ray centerRay = mRender.getCamera()->getCameraToViewportRay(
|
||||
mRender.getViewport()->getWidth()/2,
|
||||
mRender.getViewport()->getHeight()/2);
|
||||
btVector3 result(centerRay.getPoint(extent).x,-centerRay.getPoint(extent).z,centerRay.getPoint(extent).y);
|
||||
btVector3 result(centerRay.getPoint(extent).x,centerRay.getPoint(extent).y,centerRay.getPoint(extent).z);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -295,7 +294,7 @@ namespace MWWorld
|
|||
{
|
||||
//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).z,centerRay.getPoint(extent).y);
|
||||
btVector3 result(centerRay.getPoint(extent).x,centerRay.getPoint(extent).y,centerRay.getPoint(extent).z);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -335,9 +334,8 @@ namespace MWWorld
|
|||
Ogre::Vector3 to = ray.getPoint(200); /// \todo make this distance (ray length) configurable
|
||||
|
||||
btVector3 _from, _to;
|
||||
// OGRE to MW coordinates
|
||||
_from = btVector3(from.x, -from.z, from.y);
|
||||
_to = btVector3(to.x, -to.z, to.y);
|
||||
_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);
|
||||
|
||||
|
|
|
@ -1024,7 +1024,6 @@ namespace MWWorld
|
|||
// currently its here because we need to access the physics system
|
||||
float* p = mPlayer->getPlayer().getRefData().getPosition().pos;
|
||||
Vector3 sun = mRendering->getSkyManager()->getRealSunPos();
|
||||
sun = Vector3(sun.x, -sun.z, sun.y);
|
||||
mRendering->getSkyManager()->setGlare(!mPhysics->castRay(Ogre::Vector3(p[0], p[1], p[2]), sun));
|
||||
}
|
||||
|
||||
|
@ -1122,7 +1121,7 @@ namespace MWWorld
|
|||
}
|
||||
else
|
||||
p = mPhysics->getRayPoint(results.front().first);
|
||||
Ogre::Vector3 pos(p.x(), p.z(), -p.y());
|
||||
Ogre::Vector3 pos(p.x(), p.y(), p.z());
|
||||
Ogre::SceneNode* node = mFaced1.getRefData().getBaseNode();
|
||||
|
||||
//std::cout << "Num facing 1 : " << mFaced1Name << std::endl;
|
||||
|
@ -1150,7 +1149,7 @@ namespace MWWorld
|
|||
}
|
||||
else
|
||||
p = mPhysics->getRayPoint(results.at (1).first);
|
||||
Ogre::Vector3 pos(p.x(), p.z(), -p.y());
|
||||
Ogre::Vector3 pos(p.x(), p.y(), p.z());
|
||||
Ogre::SceneNode* node1 = mFaced1.getRefData().getBaseNode();
|
||||
Ogre::SceneNode* node2 = mFaced2.getRefData().getBaseNode();
|
||||
|
||||
|
@ -1299,7 +1298,7 @@ namespace MWWorld
|
|||
if (isCellExterior())
|
||||
{
|
||||
int cellX, cellY;
|
||||
positionToIndex(result.second[0], -result.second[2], cellX, cellY);
|
||||
positionToIndex(result.second[0], result.second[1], cellX, cellY);
|
||||
cell = mCells.getExterior(cellX, cellY);
|
||||
}
|
||||
else
|
||||
|
@ -1307,8 +1306,8 @@ namespace MWWorld
|
|||
|
||||
ESM::Position pos = getPlayer().getPlayer().getRefData().getPosition();
|
||||
pos.pos[0] = result.second[0];
|
||||
pos.pos[1] = -result.second[2];
|
||||
pos.pos[2] = result.second[1];
|
||||
pos.pos[1] = result.second[1];
|
||||
pos.pos[2] = result.second[2];
|
||||
|
||||
Ptr dropped = copyObjectToCell(object, *cell, pos);
|
||||
PCDropped(dropped);
|
||||
|
|
Loading…
Reference in a new issue