# Uses for trig functions in MUGEN (Read 1160 times)

Started by Bannana, February 11, 2013, 05:19:41 am

#### Bannana

##### Uses for trig functions in MUGEN
#1  February 11, 2013, 05:19:41 am
• preni ĝin kiel estas

• Online
Alright, so I understand my basic trig (even though Pre-Calc made my high school years horrible) and I've seen Aokmaniac's example of using functions to create a pendulum styled move, but I'm still at a loss as to what else you can do with it.
I don't really need code excerpts of what can be done, I'd just like to get some examples because I've never thought of fighting games needing to use these functions except if an effect had some specific movement pattern.

im buggin out man
Buriki OneMONSTER

#### 2OS

##### Re: Uses for trig functions in MUGEN
#2  February 11, 2013, 06:30:03 am
• 608 Wannabe
• Ich schicke dich zur HOELLE!! STIRB DU FEIGLING!!
circular movement.

#### Palette Jesus

##### Re: Uses for trig functions in MUGEN
#3  February 11, 2013, 08:15:44 am
• I will absolve you of your original colors.
^That's all it comes down to on the most basic level.

Knowing trigonometry and applying knowledge of trigonometry are two different things. It should be noted (as it is in the docs) that they are in radians, so you may have to convert them between radians and degrees for your various uses.

Also, the looping nature of the sin and cos functions can be used for other things like rainbow-cycling palfxes, cycling through animations. It really depends on what you need, what you know, and how you want whatever you're doing to work.

#### Cybaster

##### Re: Uses for trig functions in MUGEN
#4  February 11, 2013, 08:23:25 am
• Limited time to use Infinite power !

#### Bannana

##### Re: Uses for trig functions in MUGEN
#5  February 11, 2013, 08:44:01 am
• preni ĝin kiel estas

• Online
Quote
It should be noted (as it is in the docs) that they are in radians, so you may have to convert them between radians and degrees for your various uses.
Ah, I thought everything you entered was just considered radians when you used the functions.

So most of what the functions do don't really apply to grapplers outside of any rotations I would code for someone being thrown.
Oh well, it's still good to know just in case I decide to do something else.

im buggin out man
Buriki OneMONSTER

#### Palette Jesus

##### Re: Uses for trig functions in MUGEN
#6  February 11, 2013, 08:55:02 am
• I will absolve you of your original colors.
I can't think of any instance in which using trigonometry for throws is even remotely necessary. Unless, like, you want to throw a character and have them do like a circle in the air and you just want to use 5040, 10 and rotate it for silliness or something. I don't know, don't use trigonometry functions for simple throws. You can use angledraws, though.

##### Re: Uses for trig functions in MUGEN
#7  February 11, 2013, 10:57:43 am
Trig functions can also be used for creating random float variables with a restricted range,
for example cos(Random) will generate a random number between -1 and 1
and sin(Random) will generate a random number between 0 and 1

#### Burguertime

##### Re: Uses for trig functions in MUGEN
#8  February 12, 2013, 02:11:58 am
what about parabolae?, I mean ballistic movement, mortar and rocket launcher for a Wanzer Mecha type char...
\\\" It`s so easy to rewrite history when the few that know the truth are made unable to speak for themselves\\\"
Alexander, the last scenario...

#### Cyanide

##### Re: Uses for trig functions in MUGEN
#9  February 12, 2013, 03:45:01 am
• Legendary XIII
• I am the eye of the storm to come!
Well you could do it for that, but veladd/gravity are also perfectly suitable and require less smarts.

trig can also be used to establish an initial angle for something to travel at, for example aiming at a specific point from anywhere.

In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

#### Bastard Mami

##### Re: Uses for trig functions in MUGEN
#10  February 12, 2013, 04:35:10 pm
• [E]
generally speaking, you are going to use trig function for projectile trajectories mostly ; if you want to have nice random functions you can also use them  there, generally using time*something as the supplied value.  at least that is what I use them for, my tifa has a nearly full screen dm, but the damage follows a sin curve, where the damage it does is smaller the closer/furthes from the center you are, while the damage is maximized in the center of the screen, it uses around 50 projectiles to achieve that effect.

#### Bea

##### Re: Uses for trig functions in MUGEN
#11  February 20, 2013, 02:52:01 am
• MUGEN Grandma
Princess Adora: "My friend saw She-Ra take her dress off in the shower. She said she has an 8 pack. She said She-Ra is shredded."

SF2NES is dead. Long live SF2NES.

#### Seravy

##### Re: Uses for trig functions in MUGEN
#12  February 20, 2013, 11:29:06 pm
I think I have only used them for
-circular/elliptic movement, orbiting effects
-calculating the angle a projectile needs to be fired at (used at projectiles that target the enemy directly), to set the initial velocities
-in the scale parameter of angledraw to make an object contract/widen periodically
-or for projectiles that move on a wave shaped path.
-in trans/palfx for making light effects pulse.