mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Add emission of water ripple particles for water-walking actors (Fixes #3608)
This commit is contained in:
parent
385db50f2d
commit
16a913c549
4 changed files with 6 additions and 7 deletions
|
@ -548,7 +548,7 @@ namespace MWBase
|
|||
/// Resets all actors in the current active cells to their original location within that cell.
|
||||
virtual void resetActors() = 0;
|
||||
|
||||
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) = 0;
|
||||
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const = 0;
|
||||
|
||||
/// Return a vector aiming the actor's weapon towards a target.
|
||||
/// @note The length of the vector is the distance between actor and target.
|
||||
|
|
|
@ -117,6 +117,7 @@ RippleSimulation::~RippleSimulation()
|
|||
|
||||
void RippleSimulation::update(float dt)
|
||||
{
|
||||
const MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
for (std::vector<Emitter>::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it)
|
||||
{
|
||||
if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayerPtr())
|
||||
|
@ -128,10 +129,8 @@ void RippleSimulation::update(float dt)
|
|||
|
||||
osg::Vec3f currentPos (it->mPtr.getRefData().getPosition().asVec3());
|
||||
|
||||
if ( (currentPos - it->mLastEmitPosition).length() > 10
|
||||
// Only emit when close to the water surface, not above it and not too deep in the water
|
||||
&& MWBase::Environment::get().getWorld ()->isUnderwater (it->mPtr.getCell(), it->mPtr.getRefData().getPosition().asVec3())
|
||||
&& !MWBase::Environment::get().getWorld()->isSubmerged(it->mPtr))
|
||||
bool shouldEmit = ( world->isUnderwater (it->mPtr.getCell(), it->mPtr.getRefData().getPosition().asVec3()) && !world->isSubmerged(it->mPtr) ) || world->isWalkingOnWater(it->mPtr);
|
||||
if ( shouldEmit && (currentPos - it->mLastEmitPosition).length() > 10 )
|
||||
{
|
||||
it->mLastEmitPosition = currentPos;
|
||||
|
||||
|
|
|
@ -3313,7 +3313,7 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
bool World::isWalkingOnWater(const ConstPtr &actor)
|
||||
bool World::isWalkingOnWater(const ConstPtr &actor) const
|
||||
{
|
||||
const MWPhysics::Actor* physicActor = mPhysics->getActor(actor);
|
||||
if (physicActor && physicActor->isWalkingOnWater())
|
||||
|
|
|
@ -651,7 +651,7 @@ namespace MWWorld
|
|||
/// Resets all actors in the current active cells to their original location within that cell.
|
||||
virtual void resetActors();
|
||||
|
||||
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor);
|
||||
virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const;
|
||||
|
||||
/// Return a vector aiming the actor's weapon towards a target.
|
||||
/// @note The length of the vector is the distance between actor and target.
|
||||
|
|
Loading…
Reference in a new issue