|
| 26 Sep 2015 01:59 PM |
So my goal here is I've made a tool that creates buildings/barricades. When you equip the tool a dummy prop barricade follows your mouse around the screen using mouse.Hit.P
works good, then I added in rotation press 'R' to rotate the dummy model. My issue is I can press R and it rotates 90 degrees which works but when you click the mouse button my script is supposed to create the real model and goes to the position of the dummy model which works but I can't seem to get the right system for matching the same rotation as the dummy model. What should I do?
barricade = game.ReplicatedStorage.DummyBarricade:Clone()
local p = game.ReplicatedStorage.Barricade:Clone() -- for loop rotates 90 degrees for i = 1,90,1 do barricade:SetPrimaryPartCFrame(CFrame.new(barricade.PrimaryPart.Position)*CFrame.Angles(0,i,0)) wait() end
-- attempt to match the same rotation as the dummy model
p:SetPrimaryPartCFrame(CFrame.new(p.PrimaryPart.Position)*CFrame.Angles(0,barricade.PrimaryPart.Rotation.Y,0)) |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 26 Sep 2015 02:02 PM |
local rot = barricade.PrimaryPart.Rotation*math.pi/180 p:SetPrimaryPartCFrame(CFrame.new(p.PrimaryPart.Position)*CFrame.Angles(rot.X, rot.Y, rot.Z)) |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Sep 2015 02:12 PM |
| I figured there must of been some equation for this. |
|
|
| Report Abuse |
|
|