elliptical orbit around two objects that move

Discussion and feedback on Construct 2

Post » Sun Jul 24, 2011 6:10 am

hello.
I'm trying to orbit sprite "c" around two other objects sprite "A" and "B". Both A and B will be moving slowly.   

I'm lost on getting this to work. Help or links if this has already been answered are appreciated
B
84
S
12
G
9
Posts: 99
Reputation: 9,508

Post » Sun Jul 24, 2011 1:29 pm

therefore u need that parametric view of your circle:

(r*cos(t)+x0,r*sin(t)+y0)

else you need the distance/2 between A and B, the "rotation point". at the start of ellipse events, there must be

xk=r*cos(t0)+x0
yk=r*sin(t0)+y0

if this is correct u need

tan(startAngle)=sin(t0)/cos(t0)

for the following frames.

when u got this, the new point of C is

x= radius*cos(endAngle)
y= radius*sin(endAngle)

If u speak german, this might help you:
http://www.uni-protokolle.de/foren/viewt/45551,0.html

for instance:

t0=10=Pi/18
t1=120=2/3*Pi

(1,2)=(2*cos(t0)+x0; 2*sin(t0)+y0)

x0=1-2*cos(Pi/18 )=-0,969615506
y0=2-2*sin(Pi/18 )=1,652703645

target point:
xk=-1,969615506
yk=3,384754453xeed2011-07-24 18:24:07
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun Jul 24, 2011 5:36 pm

thank you very much. I will try this out.
B
84
S
12
G
9
Posts: 99
Reputation: 9,508

Post » Sun Jul 24, 2011 6:38 pm

ouch...that hurt my head.
B
51
S
17
G
15
Posts: 1,029
Reputation: 26,314


Return to Construct 2 General

Who is online

Users browsing this forum: TRMG, Zonacas and 1 guest