mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 19 Nov 2013 10:33 AM |
Is there any way to change the LookVector of a part?
I'm testing a few thing and I'm trying to spawn a brick and make it face the same way as another one, but it won't work.
e.g.
Part1.CFrame.lookVector = CFrame.new(Part2.CFrame.lookVector)
The error I get is that I cannot assign a LookVector.
I'm still quite an intermediate scripter so help is appreciated. |
|
|
| Report Abuse |
|
|
| |
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 19 Nov 2013 10:37 AM |
change the rotation.
for example:
lv1 = Part1.CFrame.lookVector
lv2 = (Part1.CFrame * CFrame.Angles(math.pi/2,0,0)).lookVector
if lv1 == lv2 then print("wat") else print("i was rite") end |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 19 Nov 2013 10:40 AM |
I'm not sure how to do it that way though.
I tried:
repeat wait() Part1.CFrame = CFrame.new(Part2.Position + Vector3.new(0, 1, 0) * CFrame.Angles(0, 1, 0) until Part1.CFrame.lookVector == Part2.CFrame.lookVector
As I said, still quite new to scripting.
|
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 19 Nov 2013 10:41 AM |
| Posted that last thing before I saw breuning's. |
|
|
| Report Abuse |
|
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 19 Nov 2013 10:42 AM |
easiest way to make Part1's lookVector Part2's lookVector:
Part1.CFrame = Part2.CFrame |
|
|
| Report Abuse |
|
|
mark298
|
  |
| Joined: 24 Oct 2008 |
| Total Posts: 1264 |
|
|
| 19 Nov 2013 10:45 AM |
| Wow, I feel so stupid... XD |
|
|
| Report Abuse |
|
|