Jump to content

math.sin + math.cos


Atti

Recommended Posts

These math functions are used to get a position in front of a player, by getting his rotation, i.e. for spawning ramps.

Now i need them in my script, but i don't like using things that i don't understand, so can you simply explcate me how these work? Or at least what values should i pass to the functions.

Thx a lot if you can do it, i'm really a n00b in maths. :P

Link to comment
Useless page. I know functions, i dunno WHAT are sin and cos. :mrgreen:

you might wanna ask your maths teacher :P or visit this site

http://en.wikipedia.org/wiki/Trigonometry

and these sites are awesome to help you visualize how the trigonometric circle works

http://www.senocular.com/flash/source.php?id=0.114

http://www.edumedia-sciences.com/a348_l ... ircle.html

keep in mind that Lua uses radians for math.cos, math.sin etc and MTA uses degrees, so for example if you get a player's rotation you need to convert it to radians when using these functions like this: math.cos ( math.rad ( getPlayerRotation ( getLocalPlayer() ) )

Link to comment

Useless ? Wow. I shows EXACTLY how they work with the examples. My god...

And inverses

math.acos , math.asin

Return the inverse cosine and sine of the given value.

> = math.acos(1)

0

> = math.acos(0)

1.5707963267949

> = math.asin(0)

0

> = math.asin(1)

1.5707963267949

Link to comment
You can learn how it works. I don't know trig but I can understand it and I learned from using LUA. Just make some simple math functions that output the answer to chat to learn them.. It is fairly simple.

dunno about you but if I didn't know about the basics of trig I'd have no idea what sine and cosine are, I'd say it outputs random numbers :P and probably would ask for help like Atti did

Lua doesn't teach you math

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...