mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-16 16:10:58 +00:00
Use hitbox cone only as fallback
This commit is contained in:
parent
ab433102a4
commit
f5dc9f0162
@ -846,6 +846,16 @@ namespace MWPhysics
|
|||||||
const osg::Quat &orient,
|
const osg::Quat &orient,
|
||||||
float queryDistance, std::vector<MWWorld::Ptr> targets)
|
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>();
|
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);
|
btConeShape shape (osg::DegreesToRadians(store.find("fCombatAngleXY")->getFloat()/2.0f), queryDistance);
|
||||||
|
Loading…
Reference in New Issue
Block a user