|
| 31 May 2014 02:12 PM |
I want to rotate a Part off of a point, but I'm not sure how.
Say the Part is at (5,0,0), the point is (0,0,5), and I want to rotate the Part off of that point by math.rad(75). How would I do this? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 31 May 2014 03:33 PM |
Point1 = Workspace.Middle.CFrame for i=1,360 do part.CFrame = Point1*CFrame.Angles(0,math.rad(i),0)*CFrame.new(0,0,-100) wait() end |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 03:40 PM |
So basically:
function database.Functions.RotatePartAroundPoint(part,point,angle) local translation = point-part.Position part.CFrame = point*angle*translation end |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 03:42 PM |
-.- If you knew that, why did you ask..? |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 03:51 PM |
| I didn't know that, I based it off of what you did. Was I correct? I'm not very sure about the translation part. |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 03:56 PM |
| Actually, what I did was wrong. Can anyone help? |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 04:06 PM |
Hm, would this be accurate?
function database.Functions.RotatePartAroundPoint(part,point,angle) part.CFrame = point*angle*(point-part.CFrame.p) end |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 31 May 2014 04:11 PM |
| Rotate as in make it face a certain way as well? |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 04:15 PM |
| Yes. Angle is also the offset btw. |
|
|
| Report Abuse |
|
|
|
| 31 May 2014 05:42 PM |
Rotate = function(part,StartPos,rot,distance) part.CFrame = StartPos*CFrame.Angles(0,math.rad(rot),0)*distance end
Rotate(Workspace.Part,Workspace.Part2.Position,5,CFrame.new(0,0,-10))
|
|
|
| Report Abuse |
|
|