Thirsty Panther Posted May 3, 2016 Share 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 Link to comment Share on other sites More sharing options...
Genebris Posted May 3, 2016 Share 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 Link to comment Share on other sites More sharing options...
Thirsty Panther Posted May 3, 2016 Author Share Posted May 3, 2016 Thanks Genebris. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted May 5, 2016 Share 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 Link to comment Share on other sites More sharing options...
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.