User talk:JulienDethurens/Drafts/CFraming

From Legacy Roblox Wiki
Revision as of 20:16, 22 April 2012 by >JulienDethurens (→‎lookVector)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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)
Heh, I didn't write that. theopfor wrote it, and SoulStealer put it on the wiki. The article was horrible, so I improved it. I'm going to change that. --JulienDethurens 16:16, 22 April 2012 (EDT)