Comments (6)
thanks
from polyzone.
Well EntityZones already have offset and scale options, since it inherits from BoxZone (BoxZone options), but honestly if you're using qtarget anyways, why not just target the object or model? Feel like creating a polyzone to target is just an extra step and will be less accurate as well compared to targeting the object or model directly.
from polyzone.
well qtarget relies on PolyZone
test1 = GetClosestObjectOfType(482.2, -999.4, 30.8, 1.0, 165994623, false, false, false)
iam getting the HashID from the door and with
exports.qtarget:AddEntityZone("test", test1, {
debugPoly=true,
useZ = true
}, {
options = {
{
icon = 'fas fa-shopping-basket',
label = "test",
action = function()
end
},
},distance = 2.5
})
i add a zone to the entity (it moves when i open the door) so iam telling qtarget to add a zone.
local function AddEntityZone(name, entity, options, targetoptions)
Zones[name] = EntityZone:Create(entity, options)
Zones[name].targetoptions = targetoptions
end
exports('AddEntityZone', AddEntityZone)
is from qtarget and tells PolyZone to create a EntityZone
function EntityZone:Create(entity, options)
local zone = EntityZone:new(entity, options)
_initDebug(zone, options)
return zone
end
then
function EntityZone:new(entity, options)
assert(DoesEntityExist(entity), "Entity does not exist")
local min, max = GetModelDimensions(GetEntityModel(entity))
local dimensions = {min, max}
local length = max.y - min.y
local width = max.x - min.x
local pos = GetEntityCoords(entity)
local zone = BoxZone:new(pos, length, width, options)
if options.useZ == true then
options.minZ, options.maxZ = _calculateMinAndMaxZ(entity, dimensions, zone.scaleZ, zone.offsetZ, pos)
else
options.minZ = nil
options.maxZ = nil
end
zone.entity = entity
zone.dimensions = dimensions
zone.useZ = options.useZ
zone.damageEventHandlers = {}
zone.isEntityZone = true
setmetatable(zone, self)
self.__index = self
return zone
end
so in the code above line with "local pos = GetEntityCoords(entity)" i think there should the offset happen
from polyzone.
I'm pretty sure qtarget only relies on PolyZone if you are registering BoxZone, CircleZone, or EntityZone targets. You can also use it with entities and models, seen in the docs here:
https://overextended.github.io/qtarget/entity
https://overextended.github.io/qtarget/model
These seem like they'd work better for your use case. But regardless of whether you use them, as I already said, EntityZones and BoxZones already support offset and scale options.
from polyzone.
i was just confused because here: https://github.com/mkafrin/PolyZone/wiki/EntityZone these not listed as options.
from polyzone.
If you read right above EntityZone options, it states that EntityZone inherits all but a couple of BoxZone's options.
from polyzone.
Related Issues (20)
- QUESTION HOT 2
- Polyzones linking together HOT 1
- Combo onPlayerInOut method not getting triggered HOT 8
- Not an Issue, Vehicle delete outside of Zone
- [QUESTION] Is there any way to edit inside the zone? HOT 1
- scroll down not working when working on zone
- [Potential Bug?] HOT 2
- Warning: Passed points table with less than 3 points to PolyZone:Create () {name=test}
- [HELP] Bug or misunderstanding HOT 1
- Need help on code. HOT 2
- Add support for Javascript or add exports HOT 4
- Problem in isPointInside when use circlezone HOT 1
- pzdebug command HOT 5
- Regarding Issue #90 HOT 2
- pzcreate box HOT 4
- Attempt to index a nil value HOT 1
- attempt to index a nil value
- polyzoones HOT 1
- C#
- REDM BlockWeaponThisFrame - nil value HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polyzone.