Here is where I am. My swords are mostly rotating sideways.
I have a catalog of swords. I have pulled meshes and textures from the Roblox library. So I did not control their orientation from authoring. I would like to have the swords in a catalog using Viewportframes. I have already done this with bombs and they work great. Where I am going bonkers is orienting my swords in the viewportframe.
I apply my Cframe corrections to the sword orientation, but then when I go to rotate the sword it has issues.
Can I make my Cframe corrections the new zero points for the part?
Is there a way to reorient a mesh part? I can’t get orientation to work in ViewportFrame.
local runService = game:GetService(“RunService”) – get runservice before the loop
local startingTick = tick()
local vf = Instance.new(“ViewportFrame”, script.Parent)
vf.Size = UDim2.new(1, 0, 1, 0)
vf.Position = UDim2.new(0, 0, 0, 0)
vf.BackgroundColor3 = Color3.new(1, 1, 1)
vf.BackgroundTransparency = (1)
vf.ZIndex = 20
local part = Instance.new(“Part”, vf)
part.Position = Vector3.new(0, 0, 0)
part.Anchored = false
local specialMesh = Instance.new(“SpecialMesh”)
specialMesh.MeshId = “http://www.roblox.com/asset/?id=22769578”
specialMesh.TextureId = “http://www.roblox.com/asset/?id=22769571”
specialMesh.Scale = Vector3.new(.2,.2,.2)
specialMesh.MeshType = Enum.MeshType.FileMesh
specialMesh.Parent = part
–local specialMesh = script.Parent.Mesh
–specialMesh.Parent = part
local camera = Instance.new(“Camera”, vf)
vf.CurrentCamera = camera
local cameraPosition = Vector3.new(3, 0, 2)
camera.CFrame = CFrame.new(cameraPosition, part.Position)
part.CFrame = CFrame.Angles(math.rad(270), 0, math.rad(270))
function makeBrickMove()
– rotating mesh
–[[
while true do – never ending loop
local diff = tick() - startingTick – time since loop started
–part.CFrame = CFrame.Angles(0, math.rad(diff), 0) – rotate equal to amount of time passed
part.CFrame = CFrame.Angles(math.rad(270),40*math.rad(diff), math.rad(270)) – two times as fast
-- wait a frame
runService.RenderStepped:Wait()
end
]]
end
makeBrickMove()