Advertisement
Oysi

Lua Slerp

Nov 15th, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.22 KB | None | 0 0
  1. -- Script made by Oysi
  2.  
  3. function slerp(a, b, t)
  4.     local dot = a:Dot(b)
  5.     if dot <= -1 or dot >= 1 then
  6.         return b
  7.     else
  8.         local o = math.acos(dot)
  9.         return (a*math.sin(o*(1 - t)) + b*math.sin(o*t)) / math.sin(o)
  10.     end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement