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

I'm trying to detect if any part of a vehicle model overlaps an objective marker. My script curren

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744300460a4567475.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信