I have scoured the wikis far and wide. I have viewed the YouTube videos, but with no results. The question: How do I rotate an object around a certain point instead of its center? Sorry if this seems lazy, but trust me I have searched. ~yoman1776
✓ ANSWER ACCEPTED
How to Rotate Around a Point?
2 answers
✓ Accepted answer
Utilize Object Space!
Here's an example:
local Center = CFrame.new(12, 165, 124)
local Part = workspace.Part
local i = 0
while true do
Part.CFrame = Center:toWorldSpace(
CFrame.new(
Vector3.new(
math.cos(math.rad(i)),
0,
math.sin(math.rad(i))
)*10,
Center.p
)
)
--The syntax for this is <BASECFrame>:toWorldSpace(<CFrame in BASECFrame's Object Space>)
--The inverse is then <BASECFrame>:toObjectSpace(<CFrame in World Space to Convert to BASECFrame's Object Space>)
--I.e. Center:toObjectSpace(Part.CFrame)
i = (i + 1)%360
end
Obviously, the math for this is harder if you want to rotate around an arbitrary axis, but the gist of it is there.
http://wiki.roblox.com/index.php?title=Joint <- Scroll to the bottom, there should be a few examples
Basically you make a hinge, set the two parts, and edit the C0 and C1 properties, dont ask me how to set the C1 and C0 properties, I haven't found an easy way to do it
This discussion is preserved as it was. New answers, comments, and votes are closed.
