|
| 21 Jan 2015 10:17 PM |
This doesn't make a lot of sense really.. As when testing with regular parts the rotation turns the wanted way. However here it isn't working.
What I tried in CommandBar: Workspace.p2.CFrame = CFrame.new(Workspace.p2.CFrame.p, Workspace.Part.CFrame.lookVector * 10000)
What's not working;
local dif = plane.PrimaryPart.Position-player.Character.Torso.Position plane.Name, plane.Parent = player.Name..": Plane", Workspace; plane:SetPrimaryPartCFrame(plane.PrimaryPart.CFrame + dif); plane:SetPrimaryPartCFrame(CFrame.new(plane.PrimaryPart.CFrame.p, player.Character.Torso.CFrame.lookVector * 1000)); |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 10:19 PM |
'plane.PrimaryPart.CFrame + dif)'
I assume you mean (plane.PrimaryPart.CFrame).p?
::_::goto_ |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Jan 2015 10:22 PM |
Have you set the PrimaryPart?
::_::goto_ |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Jan 2015 10:25 PM |
Hold on, you can use math on two separate datatypes within Lua? I wasn't aware you could add a Vector3 to a CFrame.
Learn something everyday I guess.
::_::goto_ |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 10:27 PM |
It is right in the wiki article.... http://wiki.roblox.com/index.php?title=CFrame#Operators |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 10:35 PM |
I'm not sure I understand why you would do this:
"plane:SetPrimaryPartCFrame(plane.PrimaryPart.CFrame + dif);" |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 10:37 PM |
| To move the plane to the Torso's position without losing orientation? |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 21 Jan 2015 10:44 PM |
You could just get the rotational matrix of the other part using "components()"
local _ ,__ ,___ , R00, R01, R02, R10, R11, R12, R20, R21, R22 = part.CFrame:components() local x,y,z = part2.Position.X,part2.Position.Y,part2.Position.Z part2.CFrame = CFrame.new(x , y, z,R00, R01, R02, R10, R11, R12, R20, R21, R22) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Jan 2015 10:46 PM |
Why you not just do this
Workspace.p2.CFrame = CFrame.new(Workspace.p2.CFrame.p, Workspace.p2.CFrame.p + Workspace.Part.CFrame.lookVector) |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 11:02 PM |
| Whilst that does work. I should add I need to rotate it on the back and right axis only. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Jan 2015 11:09 PM |
Just extract the X and Z from the lookVector alone then? Something like this should work:
local look = Workspace.Part.CFrame.lookVector; local dir = Vector3.new(look.X, 0, look.Z); Workspace.p2.CFrame = CFrame.new(Workspace.p2.CFrame.p, Workspace.p2.CFrame.p + dir)
|
|
|
| Report Abuse |
|
|
|
| 21 Jan 2015 11:39 PM |
| I ended up having to use the rotation matrix as it didn't give the desired result. Thanks for the help however. |
|
|
| Report Abuse |
|
|