Current Code:
local FallOverStructure = coroutine.wrap(function()
Lib.Map.GiantStructureParticlePart.Particles.Enabled = false
local ExplosionLight = Lib.Map.GiantStructureParticlePart.ExplosionLight
local GiantStructure = Lib.Map.GiantStructure
local Tween1 = TS:Create(ExplosionLight, TweenInfo.new(0.1), {Brightness = 100})
local Tween2 = TS:Create(ExplosionLight, TweenInfo.new(0.9), {Brightness = 0})
local Tween3 = TS:Create(GiantStructure, TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {Position = GiantStructure.Position + Vector3.new(0, -20, 70), CFrame = GiantStructure.CFrame * CFrame.Angles(math.rad(50), 0 , 0)})
local Tween4 = TS:Create(game.Lighting, TweenInfo.new(1), {OutdoorAmbient = Color3.fromRGB(120, 80, 239)})
script.ExplosionFirst:Play()
Lib.Map.PipeThatFallsForNoReason.Anchored = false
Tween1:Play()
Tween4:Play()
Tween1.Completed:Connect(function()
Tween2:Play()
end)
Tween2.Completed:Connect(function()
Tween3:Play()
script.StructureCreak:Play()
end)
Tween3.Completed:Connect(function()
StructureFell.Value = true
script.StructureFall:Play()
script.ShakeSound:Play()
game.Lighting.OutdoorAmbient = Color3.fromRGB(255, 80, 239)
Tween4:Play()
end)
end)
I’m trying to make it so that a giant structure falls over. The orientation works fine but the part’s position won’t change.
I want it to fall over like this:
Can someone help?
Y_VRN
(Y_VRNDLL)
April 7, 2023, 6:50am
2
Yozy:
CFrame.Angles(-50, 0, 0)
CFrame.Angles accept radian values only. What you have are degrees. Use math.rad(-50).
2 Likes
hbgnhu
(CrimKingNoChat)
April 7, 2023, 7:03am
3
This is not exactly true… To use them you should use math.rad, but you don’t have to.
Yozy:
CFrame.Angles(-50, 0, 0)
Should be written as:
CFrame.Angles(math.rad(50),0,0,)
The rotation works now, but the position doesn’t change
Changed the tween’s code a little but it still doesn’t work properly. Check the original post for new version
local FallOverStructure = coroutine.wrap(function()
Lib.Map.GiantStructureParticlePart.Particles.Enabled = false
local ExplosionLight = Lib.Map.GiantStructureParticlePart.ExplosionLight
local GiantStructure = Lib.Map.GiantStructure
local Tween1 = TS:Create(ExplosionLight, TweenInfo.new(0.1), {Brightness = 100})
local Tween2 = TS:Create(ExplosionLight, TweenInfo.new(0.9), {Brightness = 0})
local Tween3 = TS:Create(GiantStructure, TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.In), {Position = GiantStructure.Position + Vector3.new(0, -20, 70), CFrame = GiantStructure.CFrame * CFrame.Angles(math.rad(50), 0 , 0)})
local Tween4 = TS:Create(game.Lighting, TweenInfo.new(1), {OutdoorAmbient = Color3.fromRGB(120, 80, 239)})
script.ExplosionFirst:Play()
Lib.Map.PipeThatFallsForNoReason.Anchored = false
Tween1:Play()
Tween4:Play()
Tween1.Completed:Connect(function()
Tween2:Play()
end)
Tween2.Completed:Connect(function()
Tween3:Play()
script.StructureCreak:Play()
end)
Tween3.Completed:Connect(function()
StructureFell.Value = true
script.StructureFall:Play()
script.ShakeSound:Play()
game.Lighting.OutdoorAmbient = Color3.fromRGB(255, 80, 239)
Tween4:Play()
end)
end)
Still looking for an answer
quakage
(quakage)
April 8, 2023, 11:37pm
9
I don’t think tweening both the Position and the CFrame at the same time is a good idea. Instead just tween the CFrame:
CFrame = (GiantStructure.CFrame + Vector3.new(0, -20, 70)) * CFrame.Angles(math.rad(50), 0 , 0)
3 Likes
DasKairo
(Cairo)
April 9, 2023, 12:21am
10
It is exactly true
CFrame.Angles uses Radians to measure angles, for example:
180 degrees in radians is math.pi
360 degrees in radians is math.pi*2
math.pi
math.rad(180)
math.deg(math.pi)
180
-- The exact same thing.
All math.rad does is simply convert degrees into radians, and if you want to convert radians into degrees, use math.deg, simple process.
math.rad makes it easier for you to apply Rotational values in Radians, especially for beginners, but it is always best to learn about radians.
1 Like
hbgnhu
(CrimKingNoChat)
April 9, 2023, 8:21am
11
This is what I meant, math.rad just does conversions, so instead of writing math.rad(90) you could just do math.pi/2. You don’t have to use math.rad, so my point still stands, its not exactly true.
DasKairo
(Cairo)
April 9, 2023, 9:03am
12
You dont have to. But its really useful, and there is nothing you can do to deny that.
And either way, math.rad gives you accurate results, so idk what youre complaining about, what @Y_VRN says is exactly true tho. And you may have misunderstood what he was trying to do, because to get 50 degrees in radians by using radians is more conplicated than using math.rad, you have to understand that math.rad is intended to help you, and even tho you choose to not use it, it will always be there, so your argument does not stand.
system
(system)
Closed
April 23, 2023, 2:48pm
14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.