mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
use angles and GMST. not sure this work as it should
This commit is contained in:
parent
4c7dcdc8aa
commit
a25ee360dc
1 changed files with 21 additions and 3 deletions
|
@ -15,9 +15,12 @@
|
|||
|
||||
#include <components/nifbullet/bulletnifloader.hpp>
|
||||
|
||||
//#include "../mwbase/world.hpp" // FIXME
|
||||
#include "../mwbase/world.hpp" // FIXME
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
#include <components/esm/loadgmst.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "ptr.hpp"
|
||||
#include "class.hpp"
|
||||
|
||||
|
@ -319,8 +322,23 @@ namespace MWWorld
|
|||
result.second *= queryDistance;
|
||||
|
||||
std::pair<std::string,btVector3> result2 = mEngine->sphereTest(queryDistance,origin);
|
||||
std::cout << "physic system: getFacedHandle" << result2.first << result2.second.length();
|
||||
//std::cout << "physic system: getFacedHandle" << result2.first << result2.second.length();
|
||||
if(result2.first == "") return std::make_pair("",0);
|
||||
btVector3 a = result2.second - origin;
|
||||
Ogre::Vector3 a_ = Ogre::Vector3(a.x(),a.y(),a.z());
|
||||
a_ = orient_.Inverse()*a_;
|
||||
Ogre::Vector2 a_xy = Ogre::Vector2(a_.x,a_.y);
|
||||
Ogre::Vector2 a_yz = Ogre::Vector2(a_.y,a_.z);
|
||||
float axy = a_xy.angleBetween(Ogre::Vector2::UNIT_Y).valueDegrees();
|
||||
float az = a_yz.angleBetween(Ogre::Vector2::UNIT_X).valueDegrees();
|
||||
std::cout << axy << " " << az << "\n";
|
||||
//MWBase::Environment::get().getWorld()->getStore();
|
||||
float fCombatAngleXY = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fCombatAngleXY")->getFloat();
|
||||
float fCombatAngleZ = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fCombatAngleZ")->getFloat();
|
||||
if(abs(axy) < fCombatAngleXY && abs(az) < fCombatAngleZ)
|
||||
return std::make_pair (result2.first,result2.second.length());
|
||||
else
|
||||
return std::make_pair("",0);
|
||||
//return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue