Thirsty Panther Posted May 3, 2016 Posted May 3, 2016 I'm having a problem getting the Cos of an angle. My code is local tum = Cos(Angle) And I get the error "attempt to call global 'Cos' (a nil value)" Things I have tried: - Lower case c for cos - Brackets around Cos(Angle) - Same error occurs if I use Sin or Tan etc - Used a script variable ie Self.tum instead of local What am I doing wrong? Quote
Genebris Posted May 3, 2016 Posted May 3, 2016 You need Math:Cos(angle) http://www.leadwerks.com/werkspace/page/api-reference/_/math/mathcos-r583 It's always Class:Method. Also there is the same thing in Lua itself: math.cos(angle) 1 Quote
thehankinator Posted May 5, 2016 Posted May 5, 2016 Also there is the same thing in Lua itself: math.cos(angle) Be careful, the LE function takes degrees where as the built in lua function takes radians(since 4.0). 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.