Advertisement
tyridge77

Untitled

Sep 10th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1.         -- Preserve rotation but clamp to Y
  2.             local ccf = currentcframe;
  3.         local torsocf = (ccf - ccf.p) * CFrame.new(ccf.X,ypos, ccf.Z)
  4.        
  5.         local cf = torsocf;
  6.         local cfp = cf.p;
  7.        
  8.  
  9.         -- Move forward if walking  
  10.         if status == "walking" then
  11.           cf = CFrame.new(cfp+cf.lookVector*((.1)*Speed*updateTime))
  12.         end
  13.         cfp = cf.p;
  14.        
  15.         if turntorsoto and turntorsoto~=last_turn then
  16.             -- Changed turn
  17.             print("Changed turn");
  18.             local clamped = Vector3.new(turntorsoto.X,ypos,turntorsoto.Z)
  19.             cf = CFrame.new(cfp,clamped);
  20.         end
  21.        
  22.         currentcframe = cf;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement