Game Development Community

Could anyone help me with sin/cos use in scripts?

by Chris Hine · in Torque Game Engine · 05/24/2004 (5:41 pm) · 5 replies

Can anyone tell me how to use sin/cos in the scripting language/if it is possible? i have experience with rotating objects in other languages but i have never used it in torque and don't know if it is possible. My aim is to make a rotating camera and i need sin/cos to do this. Thankyou to anyone who can help me :).

#1
05/24/2004 (5:54 pm)
Umm i think the functions are Mcos(dir); Msin(dir);..ect :D i think anyway there some letter in front of them i know that lol.
#2
05/24/2004 (6:04 pm)
Brilliant, thanks for posting, i'll try those after my cigarette. Do you know if there are any tutorial/helper pages off hand i could double check the prefix letter on? Thanks all the same if you don't, i'll try every letter in the alphabet if i have to :D. Thanks, Chris.
#3
05/24/2004 (6:05 pm)
mSin(float)
	-Used to return the "sine" of float measured in radians
	-Returns a numeric

	%sin = mSin(65);

mCos(float)
	-Used to return the "cosine" of float measured in radians
	-Returns a numeric

	%cos = mCos(69);
see script resource for information on other script functions.
#4
05/24/2004 (6:14 pm)
Thats perfect, thanks a lot both of you, thats exactly what i needed, so cheers both of you :)
#5
05/25/2004 (6:45 am)
Note that the parameter is radians, not degrees. (360 degrees is 2*pi radians.)