最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

lua - How to detect is a model is on top of another object in Tabletop simulator - Stack Overflow

programmeradmin3浏览0评论

I'm trying to detect if any part of a vehicle model overlaps an objective marker. My script currently uses a box cast to check if the object (which has "vehicle" in its description) is on the objective:

local hits = Physics.cast({
    origin      = center,
    direction   = Vector(0,1,0),
    type        = 3, -- Box cast
    size        = Vector(objectiveRadius * 2, verticalLimit, objectiveRadius * 2),
    orientation = Vector(0,0,0),
    max_distance= 0,
    debug       = false
})

for _, hit in ipairs(hits) do
    local obj = hit.hit_object
    if obj ~= self then
        local desc = (obj.getDescription() or ""):lower()
        if desc:find("vehicle") then
            local ocVal = parseOC(obj)
            local owner = obj.getGMNotes() or ""
            -- assign ocVal to Red/Blue, etc.
        end
    end
end

However, this cast only checks against the object’s collider. I need the cast to use the object's actual mesh so that any part of the visual model (for example, an extended wing or turret) counts as overlapping the objective—even if the collider doesn't extend that far. Is there any method in Tabletop Simulator to perform a Physics.cast against an object's rendered mesh rather than its collider? If not, what are the alternatives to achieve this behavior?

发布评论

评论列表(0)

  1. 暂无评论