|
|
|
@ -1074,6 +1074,7 @@ namespace MWWorld
|
|
|
|
|
osg::Quat rot = osg::Quat(posdata.rot[0], osg::Vec3f(-1,0,0)) * osg::Quat(posdata.rot[2], osg::Vec3f(0,0,-1));
|
|
|
|
|
|
|
|
|
|
osg::Vec3f pos = ptr.getRefData().getPosition().asVec3();
|
|
|
|
|
osg::Vec3f halfExtents = mPhysics->getHalfExtents(ptr);
|
|
|
|
|
|
|
|
|
|
if (ptr == getPlayerPtr())
|
|
|
|
|
pos = getActorHeadTransform(ptr).getTrans(); // special cased for better aiming with the camera
|
|
|
|
@ -1082,11 +1083,12 @@ namespace MWWorld
|
|
|
|
|
// general case, compatible with all types of different creatures
|
|
|
|
|
// note: we intentionally do *not* use the collision box offset here, this is required to make
|
|
|
|
|
// some flying creatures work that have their collision box offset in the air
|
|
|
|
|
osg::Vec3f halfExtents = mPhysics->getHalfExtents(ptr);
|
|
|
|
|
pos.z() += halfExtents.z() * 2 * 0.75;
|
|
|
|
|
distance += halfExtents.y();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the origin of hitbox is an actor's front, not center
|
|
|
|
|
distance += halfExtents.y();
|
|
|
|
|
|
|
|
|
|
std::pair<MWWorld::Ptr,osg::Vec3f> result = mPhysics->getHitContact(ptr, pos, rot, distance, targets);
|
|
|
|
|
if(result.first.isEmpty())
|
|
|
|
|
return std::make_pair(MWWorld::Ptr(), osg::Vec3f());
|
|
|
|
|