【问题标题】:roblox CFrame not working properlyroblox CFrame 无法正常工作
【发布时间】:2018-02-28 20:57:57
【问题描述】:

代码如下:

local prt = Instance.new('Part',game.Workspace)
prt.Color = Color3.new(248, 248, 248)
prt.Size = Vector3.new(0.167, 5, 5)
prt.Rotation = Vector3.new(0, 0, math.rad(90))
prt.Anchored = true
prt.CFrame = CFrame.new(Vector3.new(19.1, 618.59, 116.85))
prt.Shape = "Cylinder"

我想要它做的是创建一个形状像圆柱体的新零件,我希望它是一个扁平的圆柱体,但它完全相反,它是直立的,我尝试了很多东西。

【问题讨论】:

  • 欢迎来到 Stack Overflow。你已经尝试过什么来做到这一点?请查看How much research effort is expected?。 Stack Overflow 不是编码服务。您应该在发布之前研究您的问题并尝试自己编写代码。如果您遇到特定的问题,请返回并附上Minimal, Complete, and Verifiable example 和您尝试过的内容的摘要,以便我们提供帮助。

标签: roblox


【解决方案1】:

CFrame 将 Rotation 设置为 0,0,0。这是因为您在 prt.Rotation 之前执行 CFrame.new()。如果你做了 CFrame.new(Vector3.new(19.1,618.59,116.85)) * CFrame.Angles(0, 0, math.rad(90)),这会起作用,你可以删除“prt.Rotation”部分。

【讨论】:

    猜你喜欢
    • 2020-10-29
    • 1970-01-01
    • 2011-05-17
    • 2016-12-01
    • 2021-07-05
    • 2019-03-13
    • 2020-04-22
    • 1970-01-01
    • 2016-09-01
    相关资源
    最近更新 更多