ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries

v3.0.0 Breakdown

New version, yay!

1. Goodbye RotatedRegion3, hello OverlapParams

Internal Region and RotatedRegion3 checks have been entirely replaced with the new Spatial Query API. This should bring about performance gains, particularly over the long term as this API is improved.


2. You can now track anything

With new Item events and methods you can now track anything. Humanoid Dummies? Check. Zombie NPCs? Check. Spaceships? Check. Pineapple Bombs? Check.

First, setup your events:

zone.itemEntered:Connect(function(item)
    print(("item '%s' entered the zone!"):format(item.Name))
end)

zone.itemExited:Connect(function(item)
    print(("item '%s' exited the zone!"):format(item.Name))
end)

Then simply track any BasePart, Character or NPC you wish to have detected when entering and exiting the zones:

zone:track(zombieNPC)
zone:track(spaceshipHullPart)
etc

@g_dson @Stellabotrus This solves the humanoidEvent feature request and touchTransmitter issue you mentioned.


3. One-time use methods

Introducing zone:onItemEnter and zone:onItemExit which track a specific item until it has entered/exited the zone, then calls the given callbackFunction.

local item = character:FindFirstChild("HumanoidRootPart")
zone:onItemEnter(item, function()
    print("The item has entered the zone!"))
end)
local item = character:FindFirstChild("HumanoidRootPart")
    zone:onItemExit(item, function()
    print("The item has exited the zone!"))
end)

This is useful for scenarios where you may only want to listen for an item entering/exiting a zone after a certain trigger, instead of constantly.


4. Enhance zones with bindable SettingsGroups

A frequently reported difficulty in the past has been to do with zones that rest directly next to each other. If you were creating zones for example which played and stopped music, you would often find music played/stopped incorrectly as the entered event of one zone would fire before the exited event of the other zone.

This can now be overcome by simply binding those zones to the same settingsGroup:

for i = 1, 3 do
    local zone = Zone.new(part)
    zone:bindToGroup("EnterOnlyOneZoneAtATime")
end

settingsGroups currently only contain one property, onlyEnterOnceExitedAll (which defaults to true), although can be customised in the future with ZoneController.setGroup.

Behaviour without SettingsGroups:

Behaviour with SettingsGroups:

@LordMerc @Maxx_J This helps overcome the problems you both mentioned a few months back. I’ve updated the playground examples to now include this.


5. It’s time to disappear…

You can now snap zones out of workspace with the new relocate method:

zone:relocate()

Perfectly balanced, as all things should be.

This is also accompanied with a new constructor, Zone.fromRegion, enabling the construction of zones without any containers/baseparts:

local zoneCFrame = CFrame.new()
local zoneSize = Vector3.new(3000, 3000, 3000)
local zone = Zone.fromRegion(zoneCFrame, zoneSize)

6. Additional

  • By default, Zones will now only check the Centre of characters (i.e. their HumanoidRootParts). This is because it provides performance gains and most users previously didn’t require whole-body checking. If you wish to revert back to the whole-body checking of characters, simply do:
    zone:setDetection("WholeBody")
    
  • Replaced Maid with Janitor by @pobammer
  • Replaced Signal with GoodSignal by @stravant

A full breakdown of API changes can be found here:

31 Likes