User talk:JulienDethurens/Drafts/CFraming

From Legacy Roblox Wiki
Revision as of 20:13, 22 April 2012 by >NXTBoy (Created page with "==lookVector== <blockquote>Now I want to dedicate a section to lookVector because of how useful it is. lookVector is used mainly for scripters. What lookVector does is return...")
Jump to navigationJump to search

lookVector

Now I want to dedicate a section to lookVector because of how useful it is. lookVector is used mainly for scripters. What lookVector does is returning the rotation matrix of the brick's CFrame (see above). So if I wanted a block to move forward but it was rotated at an unkown angle I would use lookVector.

Not true at all. lookVector is mostly useless. The example would be better written as:

local p = Workspace.Part
p.CFrame = p.CFrame * CFrame.new(0, 0, 15)  -- Moves forward
p.CFrame = p.CFrame * CFrame.new(0, 0, -15) -- Moves backward
p.CFrame = p.CFrame * CFrame.new(15, 0, 0)  -- Moves to one side
p.CFrame = p.CFrame * CFrame.new(-15, 0, 0) -- Moves to the other
20:13, 22 April 2012 (UTC)