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
Utilize Object Space!
Here's an example:
01 | local Center = CFrame.new( 12 , 165 , 124 ) |
02 | local Part = workspace.Part |
03 | local i = 0 |
04 | while true do |
05 | Part.CFrame = Center:toWorldSpace( |
06 | CFrame.new( |
07 | Vector 3. new( |
08 | math.cos(math.rad(i)), |
09 | 0 , |
10 | math.sin(math.rad(i)) |
11 | )* 10 , |
12 | Center.p |
13 | ) |
14 | ) |
15 | --The syntax for this is <BASECFrame>:toWorldSpace(<CFrame in BASECFrame's Object Space>) |
16 | --The inverse is then <BASECFrame>:toObjectSpace(<CFrame in World Space to Convert to BASECFrame's Object Space>) |
17 | --I.e. Center:toObjectSpace(Part.CFrame) |
18 | i = (i + 1 )% 360 |
19 | 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