【问题标题】:How do I anchor a part in Roblox Studio without anchoring it?如何在 Roblox Studio 中锚定零件而不锚定它?
【发布时间】:2022-08-06 03:30:35
【问题描述】:

我为我的塔防游戏制作了一个小型测试船,我需要炮塔旋转而不是船的其余部分,由于网络所有权,我无法锚定船。如果我尝试在船(非炮塔部分)上焊接或添加接头,它会旋转整艘船。如果没有焊缝,船会传送到我将其放入复制存储(但不是炮塔)之前的位置。我使用了一个人形机器人来旋转炮塔,以使其更容易设置。那么如何确保船底座放置在选定的位置并且只有炮塔旋转? The Boat Base spawns in one spot but not the turret.The joints and everything in the whole boat tower.

local allowedToSpawn = tower.CheckSpawn(player, name)

if allowedToSpawn then
    
    local newTower = ReplicatedStorage.Towers[name]:Clone()
    newTower.HumanoidRootPart.CFrame = cframe
    newTower.Parent = workspace.Towers
    newTower.HumanoidRootPart:SetNetworkOwner(nil)
    
    local bodyGyro = Instance.new(\"BodyGyro\")
    bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
    bodyGyro.D = 0
    bodyGyro.CFrame = newTower.HumanoidRootPart.CFrame
    bodyGyro.Parent = newTower.HumanoidRootPart

    for i, object in ipairs(newTower:GetDescendants()) do 
        if object:IsA(\"BasePart\") then
            PhysicsService:SetPartCollisionGroup(object, \"Towers\")  
        end
    end

    标签: lua roblox


    【解决方案1】:

    将炮塔的位置设置为船的位置并给它一个偏移量

    local boat = the boat
    local turret = the turret
    
    while wait() do
    turret.Position = boat.Position + Vector3.new(1,1,1) --the offset
    end
    

    如果你不是这个意思,那我不知道你想要什么

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-15
      • 1970-01-01
      • 2020-02-03
      • 2015-02-19
      • 2020-05-12
      相关资源
      最近更新 更多