forked from mirror/openmw-tes3mp
Use hitbox cone only as fallback
This commit is contained in:
parent
ab433102a4
commit
f5dc9f0162
1 changed files with 10 additions and 0 deletions
|
@ -846,6 +846,16 @@ namespace MWPhysics
|
|||
const osg::Quat &orient,
|
||||
float queryDistance, std::vector<MWWorld::Ptr> targets)
|
||||
{
|
||||
// First of all, try to hit where you aim to
|
||||
int hitmask = CollisionType_World | CollisionType_Door | CollisionType_HeightMap | CollisionType_Actor;
|
||||
RayResult result = castRay(origin, origin + (orient * osg::Vec3f(0.0f, queryDistance, 0.0f)), actor, targets, 0xff, hitmask);
|
||||
|
||||
if (result.mHit)
|
||||
{
|
||||
return std::make_pair(result.mHitObject, result.mHitPos);
|
||||
}
|
||||
|
||||
// Use cone shape as fallback
|
||||
const MWWorld::Store<ESM::GameSetting> &store = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
btConeShape shape (osg::DegreesToRadians(store.find("fCombatAngleXY")->getFloat()/2.0f), queryDistance);
|
||||
|
|
Loading…
Reference in a new issue