angles2tranlations

For questions about using Classic.

Post » Tue Sep 09, 2008 11:38 am

what i mean here is i want an object to move in the direction of a given angle, using coordinate translations, for a custom movement, now i have been developing something similar to this but i havnt gotten everything, its basically a formula which you input an angle and it returns to you scaled values so it will still move 1pxl per second, but in the angle of the given angle, meaning 45 would return to you something like 0.7y 0.7x understand (seperately of course)? then you scale your value according to those given numbers by multiplying them by it.

i was just wondering if this existed already, because i made this all by myself but im sure some 1700's mathematician has already done it lol. so is there a way?
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Tue Sep 09, 2008 11:52 am

So speaking simple you want to ball move slower if the angle is rising
Sounds like Cosinus to me.
Cosinus give value of 1 when the angle is 0 and gives value of 0 when the angle is 90. Like here

btw ? is = 180 degrees
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Tue Sep 09, 2008 2:34 pm

man you really need to learn trig :lol: !

set X to .x+speed*cos(angle)
set Y to .y+speed*sin(angle)

what you want are actually the sin and cos functions themselves!

they go from -1 to 1 like the picture above, if you plot X=cosA and Y=sinA for every value of A, it will give you a circle with radius 1.

so if the angle is 0, (you're going horizontally to the right) cos(angle) gives 1, and sin angle gives 0, so you'll be moving 1 to the right. if angle is 90 (vertical) sin(angle) gives 1, and you're Y will be moving correctly.

It's tempting to make a trigonometry 101 page for the wiki, though I've been doing it for so long I don't know what it's like for someone who's never learnt it :) .

[quote:kgmy9vbb]i was just wondering if this existed already, because i made this all by myself but im sure some 1700's mathematician has already done it lol. so is there a way?[/quote:kgmy9vbb]
try some 4000 year old mathematician lol
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Tue Sep 09, 2008 8:14 pm

[quote:jxwk366c]try some 4000 year old mathematician lol[/quote:jxwk366c]

lol, thats all i have to say

and a trig 101 would be useful to us who learn faster than the schools can teach us

im amazed i thought of such things! i would of been inventing the wheel in my own way :lol: !
wow, i just realised ive understood trig all along, i just need a 101 page :P
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests