Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> Sin/Cosin, ...haha...
United States
Banana Head
Posted: Nov 28 2005, 11:14 PM
Quote Post


<3
[*][*][*]

Group Icon
Group: Members
Posts: -95
Member No.: 166
Joined: 30-November 03

Status: (0d) [--]


Okay, how would i convert a an MMF direction to a 360* direction, and then figure out the appropriate values to add/subtract to the X/Y speed to apply a force in that direction

err... maybe this will make more sense

How would i take Object A, and apply force C (in this case 10) to direction B (in this case 45) and ultimatly end up with an X/Y value to add to the X/Y speeds of the object
user posted image

(If it matters, the speeds are the Platorm movment objects speeds, which are in 1/100's pixels per second)

This post has been edited by Banana Head on Nov 28 2005, 11:16 PM


--------------------
PMUsers WebsiteAOLYahooMSN
Top
United States
Banana Head
Posted: Nov 28 2005, 11:35 PM
Quote Post


<3
[*][*][*]

Group Icon
Group: Members
Posts: -95
Member No.: 166
Joined: 30-November 03

Status: (0d) [--]


Well, i managed to hack something together that does what i wanted, but i would still like to know how to do it properly if anyone feels like explaining.


--------------------
PMUsers WebsiteAOLYahooMSN
Top
Netherlands
dsguru
Posted: Dec 1 2005, 01:53 PM
Quote Post


ProLurker
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 796
Member No.: 1628
Joined: 10-November 05

Status: (0d) [--]


QUOTE (Banana Head @ Nov 28 2005, 11:35 PM)
Well, i managed to hack something together that does what i wanted, but i would still like to know how to do it properly if anyone feels like explaining.

this is tricky stuff and it makes my head hurt.
i will try to explain what i know (wich isn't much)

first the simple stuff, converting degrees (angle) to the direction in mmf.

CODE
"direction" x 11,25 = "angle"

example:
CODE
32 x 11,25 = 360
9 x 11,25 = 101,25


simple right?

now it gets harder ohmy.gif
first create 4 alterable values, "x", "y", "angle"

upon aplying force:
CODE

- set value "angle" to "the angle you wish to apply the force"
- set value "x" to xposition of the object you wish to apply force to.
- set value "y" to yposition of the object you wish to apply foce to.


that was the beginning of the force rolleyes.gif
now lets make your object move.

always:
CODE

- set xposition of your object to value:"x"
- set yposition of your object to value:"y"
- set value "x" to (("x") + sin(value "angle")) x 5
- set value "y" to (("y") + cos(value "angle")) x 5


"x 5" is the speed of the object, wich can of course be replaced by another alterable value.
(you should do that, cause if it is "0" the object will stay still and of course increasing it will cause the object to move faster)

i don't know if this is exactley how it goes, it has been a long time since i opend mmf and it's angle functions are a bit weird. ohmy.gif

you could of course speed up the entire thing with fastloops but this will do for simple force calculation.

if anything is wrong with this let me know, i will try and fix it.


--------------------
PMEmail PosterUsers WebsiteMSN
Top
United States
RelmM
Posted: Dec 1 2005, 03:47 PM
Quote Post


Surprise!
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 9317
Member No.: 180
Joined: 11-December 03

Status: (0d) [--]


Sine = X
Cosine = Y

Sine is the ratio between the length of a RIGHT triangle and it's hypotenuse.

Cosine is the ratio between the base (The part that looks like teh floor) and it's hypotenuse.

(Sine and Cosine = Rise and Run = Y and X)

Sine and Cosine is dictated by an angle(In which is the hypotenuse, NOTICE HOW ITS DIAGONAL.). Sine and Cosine and easily calculated

FOR INSTANCE FRIENDS

Sine and Cosine never reach over the absolute value of 1 (Max: 1 Min: -1) because tis division. How much the length side (The one perpendicular to the base which is the SIDE STICKING OUT STRAIGHT UP) is long to the hypotenuse is the Sine. If the length of a triangle is half as long as the hypotenuse, the sine will be 0.5

The sine of 90 is always 1 because it sticks UP and well.. it's a line so length and hypotenuse are the same; The cosine of 90 is 0 because vertical lines don't have width HOWEVER The cosine of 180 is a horizontal line is 1 because the base is AS long as the hypotenuse and the Sine is 0 because horizontal lines don't stick up

Since the min for the two biatches are -1 they must have QUADRANTS. Remember that coordinate grid in which you had to plot dots? Remember it had 4 squares making it up? And had four lines sticking out of a center? Yea

COORDINATE GRID:

X COORDINATE NEGATIVE I X COORDINATE POSITIVE
Y COORDINATE POSITIVE I Y COORDINATE POSITIVE
--------------------------------(0)--------------------------------------------
X COORDINATE NEGATIVE I X COORDINATE POSITIVE
Y COORDINATE NEGATIVE I Y COORDINATE NEGATIVE

Sine and Cosine are X and Y. NOTICE CENTER. That's where the right triangle will stick out. (The right triangle always has its "toes" to 0. When Sine is negative its toes still stick to 0 but are just upside down)

Remember Sine and Cosine all use one triangle! That one triangle represents the angle of the hypotenuse.

WILL POST SOMETHING NEW SOON.

This post has been edited by M.A.R.S on Dec 1 2005, 03:54 PM


--------------------

user posted image
PMAOLMSN
Top
Canada
MikeL
Posted: Dec 2 2005, 10:33 PM
Quote Post


expert
[*][*]

Group Icon
Group: Members
Posts: 11327
Member No.: 267
Joined: 28-January 04

Status: (0d) [--]


I believe MMF angle -> 360° is * 12, so it stands to reason that dividing will go the other way
PMEmail PosterUsers WebsiteAOLMSN
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0493 ]   [ 13 queries used ]   [ GZIP Enabled ]   [ Server Load: 0.55 ]