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

What's the simplest way to rotate a model 90 degrees?

Asked by
NotPix 2
7 years ago
Edited 7 years ago

Assuming the parts in the model is unanchored and welded together, would I use SetPrimaryPartCFrame()? Attempting to make a flippable table with animation. Preferable on a key down function, using magnitude to check if your next to it Here's what I got so far..


mouse=game.Players.LocalPlayer:GetMouse() function checkTableDistance(torso,table,dist) for i,v in pairs(table) do if (v.Position-torso.Position).magnitude<=dist then return true end end. end function findNearestTable(torso,table) mags={} for i=1,#table do table.insert(mags,#mags+1,(#table[i].Position-torso.Position).magnitude) end return math.min(mags) end while wait(0.5) do if checkTableDistance(game.Players.LocalPLayer.Character.Torso ,Workspace.table:GetChildren()) then --gui end mouse.KeyDown:connect(function(key) if key=="e" and checkTableDistance() then table=findNearestTable(game.Players.LocalPlayer.Character.Torso,Workspace.table:GetChildren()) --table flippy end end)
0
What do you mean? devo2230 0 — 7y
0
CFrames Are The Simplest Way to rotate LearnBeginnersLua -2 — 7y
0
what would I add above to achieve the 90 degree flip? NotPix 2 — 7y
0
CFrame * CFrame.Angles(math.rad(x), math.rad(y), math.rad(z)) SquirreIOnToast 309 — 7y

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

Set a primary part to the model, use SetPrimaryPartCFrame and GetPrimaryPartCFrame,



Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.Angles(--[[your angle X,Y,Z]]))
Ad

Answer this question