Mathematical problem XY, PI, Angle,

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
Hi
I forgot the equation to calculate a distance traveled with the angle pi

Here my context
//Picture 1 have position [x,y,angle]
P1xy = [10, 10, 0];
//Picture 2 have position with picture1 [x,y]
P2xY = [(P1xy[0]+10), (P1xy[1]+20)]

But if the angle of my picture 1 change
Which formula I will be able to use, to take into consideration, the angle distance
And picture2 follow xy of picture1 with angle distance
thanks
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
Not sure what you mean. Changing the angle of the picture isn't going to change that pictures x/y position. This is because the it's anchor/pivot are it's x/y position so it will rotate on that position. Now this is a different story if you're trying to get a position inside the picture besides it's 0,0 point, since those will change when its angle changes.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
591
First Language
English
Primarily Uses
RMMV
http://www.helixsoft.nl/articles/circle/sincos.htm
I was getting into this tutorial ^ when I wrote my race car movement script. All you need to remember is sin and cos.
PHP:
// angle = 1 to 360 * radian;
// radian = Math.PI / 180;
speedX = speed * Math.cos ( angle );
speedY = speed * Math.sin ( angle );
// _x or _realX += speedX;
// _y or _realY += speedY;
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
i find my way thanks
Code:
for (var i = 0; i < steps; i++) {
    x = (posx+ radius * Math.cos(2 * Math.PI * i / steps));
    y = (posy+ radius * Math.sin(2 * Math.PI * i / steps));
     $gameScreen.showPicture(PID++, filename, 1, x, y, 100, 100, 255, 0); //#b43a3a ORBS
}
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top