【发布时间】: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