I'm trying to make a propeller (that consists of multiple unions) spin in a circular rotation.
I figured I could just rotate the model that the unions are in but the plane will be moving when the propeller rotates. Can't do that with normal CFrame, I'm pretty sure.
Which leads me to welds. Since Welds ignore physics (To my knowledge..)
How would I rotate all of them at once, they would have different positions and rotations so would I have to do them desperately?
Here are a few pictures of the plane propeller and hierarchy.
Propeller - http://prntscr.com/7l0v95
Hierarchy - http://prntscr.com/7l0wr5
Anyone know of a good way to start with this? I have read the wiki but I'm still in the dust here, which is why I have asked here. :)
If the model is going to be moving around while you need the propellers to spin, Then yes, manipulating the Welds is just about the only way to make that happen effectively. Welds, and every related object "Ignore physics" by constantly maintaining the same distance between 2 parts with CFrames, If you look at the properties of a Weld, the 4 important properties you'll see are Part0, Part1, C0 (that's zero, not capital "o"), and C1. Part0 and Part1 tell the weld which 2 parts you are trying to keep together, C0 and C1 are a sort of "local CFrame" for each part. The wiki has a great visualization of what this looks like, so just search "Joints" over on that site if you're curious. These local CFrames are a little bit counterintuitive to work with at first, so the lines of code to reliably weld your 2 parts together are here:
weld.Part0 = basepart weld.Part1 = propellerPart weld.C0 = basepart.CFrame:inverse() weld.C1 = basepart.CFrame:inverse() * Cframe.new(propellerPart.Position)
With this, you can now manipulate C1 to change the angle of the propeller, relative to the other part. The best way would be to use a loop that constantly adds a small angle to C1 using *CFrame.Angles(0,1,0)
(Angles are in Radians, not degrees, meaning 1 is actually a big increase). Again though, I think this wiki page has a much better answer to your question than I can give: http://wiki.roblox.com/index.php?title=Joints
I would try to use a for loop that runs multiple coroutines that rotate the parts, **something ** like:
for index, child in pairs(model:GetChildren()) do local q = coroutine.wrap(function() child.CFrame = Child.CFrame*CFrame.Angles(#,##) end) q() end
or you could weld them to a invisible center part and just rotate that part, which would be much simpler.