Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Preserve rotation but clamp to Y
- local ccf = currentcframe;
- local torsocf = (ccf - ccf.p) * CFrame.new(ccf.X,ypos, ccf.Z)
- local cf = torsocf;
- local cfp = cf.p;
- -- Move forward if walking
- if status == "walking" then
- cf = CFrame.new(cfp+cf.lookVector*((.1)*Speed*updateTime))
- end
- cfp = cf.p;
- if turntorsoto and turntorsoto~=last_turn then
- -- Changed turn
- print("Changed turn");
- local clamped = Vector3.new(turntorsoto.X,ypos,turntorsoto.Z)
- cf = CFrame.new(cfp,clamped);
- end
- currentcframe = cf;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement