Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my part not being CFramed correctly?

Asked by
farrizbb 465 Moderation Voter
6 years ago

I'm trying to CFrame a cylinder part, so that it's start is in the middle of a sphere. The cylinder and the part both vary in the size as they grow,but their base is 4,4,4(sphere) and 8,4,4(cylinder).

I CFrame the part with this part of the script.

Blast.CFrame = Player.Character.OuterBall.CFrame * CFrame.new(0, Blast.Size.X/-2 --[[Trying to move it by half of the cylinder's x axis so it's start ends up at the front--]], 0)

Here is some context if it helps.

local Blast = Instance.new("Part")
        local Weld3 = Instance.new("WeldConstraint")
        Weld3.Part0 = Player.Character.InnerBall
        Weld3.Part1 = Blast
        Weld3.Parent = Blast
        Blast.Name = "Blast"
        Blast.Color = Color3.fromRGB(0,255,255)
        Blast.Material = "Neon"
        Blast.Transparency = 0.5
        Blast.CanCollide = false
        Blast.Shape = "Cylinder"
        Blast.Size = Vector3.new(Player.Character.OuterBall.Size.X * 4, Player.Character.OuterBall.Size.Z, Player.Character.OuterBall.Size.Y)
        Blast.CFrame = Player.Character.OuterBall.CFrame * CFrame.new(0, Blast.Size.X/-2, 0)
        Blast.Orientation = Vector3.new(-45,0,90)
        Blast.Parent = Player.Character

This is what it looks like: Image1

This is what it looks like: Image2 With

Player.Character.OuterBall.CFrame * CFrame.new(Blast.Size.X/-2, 0, 0)

Instead of

Player.Character.OuterBall.CFrame * CFrame.new(0, Blast.Size.X/-2, 0)

If anymore context is needed please tell me.

1 answer

Log in to vote
0
Answered by 6 years ago

try

Player.Character.OuterBall.CFrame * CFrame.new(Vector3.new(Blast.Size.X/-2, 0, 0))
0
That still didn't work. I think it might be a collision problem and Roblox is automatically changing the part's position. farrizbb 465 — 6y
Ad

Answer this question