|
| 20 Apr 2016 05:54 PM |
The following code demonstrates rotating a part so that its position stays the same, but the lookVector (defined as the vector coming out of the front face, or Vector3.new(0, 0, -1) transformed to the parts rotation matrix), is now pointed at 0, 75, 75.
Workspace.Part.CFrame = CFrame.new(Workspace.Part.Position, Vector3.new(0, 75, 75))
My question is: Why are there only 2 things within the parenthesis of CFrame.new()? Isn't it supposed to have 3-- x,y,z? |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2016 05:58 PM |
| Also, whats the difference between CFrame.fromEulerAnglesXYZ and CFrame.Angles? |
|
|
| Report Abuse |
|
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
|
| 20 Apr 2016 05:59 PM |
because the first argument is the origin of the CFrame. and argument 2 is the Vector3 that the CFrame will be looking at.
|
|
|
| Report Abuse |
|
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
|
| 20 Apr 2016 06:00 PM |
answering your second question, they are the same.
|
|
|
| Report Abuse |
|
|
|
| 20 Apr 2016 06:03 PM |
I have more questions. CFrame:inverse() If the regular CFrame is (1,1,1) will this make it (-1,-1,-1)? CFrame:lerp(CFrame goal, number alpha) And I don't understand the explanation the wiki gives for this (returns a CFrame interpolated between this CFrame and the goal by the fraction alpha) |
|
|
| Report Abuse |
|
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
|
| 20 Apr 2016 06:36 PM |
idk about those. they seem like advanced CFrame functions.
|
|
|
| Report Abuse |
|
|
|
| 20 Apr 2016 07:36 PM |
Test that out in game and see for yourself! local CF1 = game.Workspace.Part.CFrame game.Workspace.Part.CFrame = CF1:inverse()
CFrame:lerp() The description is a bit weird but its super valuable! (returns a CFrame interpolated between this CFrame and the goal by the fraction alpha)
local CF1 = game.Workspace.Part.CFrame local Goal = CFrame.new(0,5,5) for Index = 1, 10 do game.Workspace.Part.CFrame = CF1:lerp(Goal,Index/10) wait(.2) end
It positions a CFrame between two points (CF1 and CF2) by the Alpha.
If you wanted it to move half way your Alpha would be .5, full distance would be 1 |
|
|
| Report Abuse |
|
|