No announcement yet.

waterVolume.Encompasses() question...

  • Filter
  • Time
  • Show
Clear All
new posts

    waterVolume.Encompasses() question...

    I have a WaterVolume in my map, and I want to invoke the method defined in the parent class Volume (Volume->PhysicsVolume->WaterVolume) called Encompasses(). Here is the code found in Volume.uc:

    native function bool Encompasses(Actor Other); // returns true if center of actor is within volume

    I can never get this method to return anything but false, whether or not the Actor "other" is in the volume or not. In the TakeDamage() function of another Pawn AIcontroller, I have placed this code:

    if (waterVolume.Encompasses(InstigatedBy))
    log("NOT underwater");

    So when the Pawn I am controlling in the game shoots the other Pawn containing the above code, MY Pawn is the instigator. I have verified that in the debugger. But Encompasses() always return false, even when my Pawn is totally submerged in the volume. What gives? Has anyone successfully used this method? Thanks!

    I did a quick text search for any uses of 'encompasses' and found that it is used in the following classes: PlayerReplicationInfo (to get the location name), PotentialClimbWatcher (bots on ladders), GravityTrigger (for modifying jumppad directions), and ASGameInfo (for determining critical players). I know that it works in these classes (or at least the PlayerReplicationInfo class).

    What sets the watervolume variable to an actual volume in the level? Are you getting any accessed nones in the log file?


      The instance of the WaterVolume in question is a var() parameter, I set it in the properties page, and check for it still being None in PostBeginPlay() for the controller. It's set.

      Hmmm... strange things, I really don't know where to go from here. It seems like there are lots of details and "gotchyas" under the hood in Unreal. But I'll have a look at the classes you mentioned and see if I can spot anything I overlooked. Thank you.


        Did you check whether instigatedBy is actually set to the Pawn in question? Since a WaterVolume is a PhysicsVolume and any actor's surrounding PhysicsVolume is referenced in the actor's PhysicsVolume property, it might be more efficient to check if (waterVolume == instigatedBy.PhysicsVolume).