mkafrin / PolyZone

PolyZone is a FiveM mod to define zones of different shapes and test whether a point is inside or outside of the zone
MIT License
204 stars 191 forks source link

[Help Request] Entity Zone not giving output #72

Open Datsun-Drift opened 1 year ago

Datsun-Drift commented 1 year ago

I have created an entity zone for a vehicle and set the offset as desired. Zone creates w/o error. Debugging is on to ensure I enter the bounding box. I'm using onPLayerInOut for the coordinate definition and toggling a variable via isPointInside. When the player ped enters the zone, I have it set to print the value of the variable, but nothing happens at all. Not sure what I may be doing wrong here, as I have successfully created & used entity zones in other projects. code snippet provided below.

function CreateVehicleZone()
    local VehZone = EntityZone:Create(TruckData.Id,{
        name = 'DeliveryVehicle',
        useZ = true,
        debugPoly = Cfg.DebugTruck,
        offset = {-5.0,0.7,0.0,0.0,0.0,0.0},
    })
    VehZone:onPlayerInOut(function(isPointInside,point)
        if isPointInside then
            inVZ = true
            print('inVZ: '..tostring(inVZ))
        else
            inVZ = false
            print('inVZ: '..tostring(inVZ))
        end
    end)
end
Datsun-Drift commented 1 year ago

Image attached for reference. image

Datsun-Drift commented 1 year ago

[Solved] Seems that because I had used the offset to move the zone past the center of the vehicle, it cancelled out the zone interaction. I removed the forward offset yet left the rest and it now works. If any explanation could be given on the issue I would appreciate it.

mkafrin commented 1 year ago

Hmm, I don't believe this is intended behavior. At least, it seems to me that what you attempted should be supported, or if it can't be, a descriptive error should be returned rather than silently failing. Let me do some testing to find the root cause and see if a fix is possible.

bedoflex commented 6 months ago

Hmm, I don't believe this is intended behavior. At least, it seems to me that what you attempted should be supported, or if it can't be, a descriptive error should be returned rather than silently failing. Let me do some testing to find the root cause and see if a fix is possible.

I have same problem i have a casino box zone Im leaving the zone but not giving me false output.