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.

1Blast.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.

01local Blast = Instance.new("Part")
02        local Weld3 = Instance.new("WeldConstraint")
03        Weld3.Part0 = Player.Character.InnerBall
04        Weld3.Part1 = Blast
05        Weld3.Parent = Blast
06        Blast.Name = "Blast"
07        Blast.Color = Color3.fromRGB(0,255,255)
08        Blast.Material = "Neon"
09        Blast.Transparency = 0.5
10        Blast.CanCollide = false
11        Blast.Shape = "Cylinder"
12        Blast.Size = Vector3.new(Player.Character.OuterBall.Size.X * 4, Player.Character.OuterBall.Size.Z, Player.Character.OuterBall.Size.Y)
13        Blast.CFrame = Player.Character.OuterBall.CFrame * CFrame.new(0, Blast.Size.X/-2, 0)
14        Blast.Orientation = Vector3.new(-45,0,90)
15        Blast.Parent = Player.Character

This is what it looks like: Image1

This is what it looks like: Image2 With

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

Instead of

1Player.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

1Player.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