|
| 05 Nov 2014 06:52 PM |
Hello, can someone please tell me what is wrong with the following code? I am trying to make the brick 'gun' (which is welded to another brick) rotate 45 degrees on the y axis without moving the other brick. --Begin code
function Weld(p1,p2) local weld = Instance.new("Weld") weld.Part0 = p1 weld.Part1 = p2 weld.C0 = p1.CFrame:inverse() weld.C1 = p2.CFrame:inverse() weld.Parent = p1 return weld end
function rotateDegrees(part,degrees,weld) weld.C1 = weld.C1 * CFrame.Angles(0,degrees * math.pi/180,0) end
local w = Weld(gun,ship.mainpart) rotateDegrees(gun,45,w) |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2014 07:18 PM |
I'm not certain, but I think 'gun' needs to be Part1 instead of Part0 for that. I am probably wrong though. I just thought Part0 was the anchor, and if you rotate the weld, you rotate Part1. |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2014 08:02 PM |
| Thats definitely not it. Any other ideas? |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2014 08:05 PM |
Maybe you should give up and become a poet or playwright.
Seriously though, I'm out of all other ideas. |
|
|
| Report Abuse |
|
|
anaIyze
|
  |
| Joined: 29 May 2014 |
| Total Posts: 2048 |
|
|
| 05 Nov 2014 08:17 PM |
function rotDeg(p,deg) p.Weld.C0=p.Weld.C0*CFrame.Angles(0,math.pi/180*deg,0); end; |
|
|
| Report Abuse |
|
|