[solved]Tilted ellipse orbiting movement?

  • Hi, I wonder if anyone know how to make a ellipse movement and tilted?

    <img src="https://dl.dropbox.com/u/1396615/bugImage/ellipse.png" border="0" />

    I know how to make a circle and standard ellipse. example:

    Object.x = center.X+cos(time*300)*200

    Object.y = center.Y+sin(time*300)*300

  • Have you tried taking the output of that, and then feeding into this, where a is the angle of tilt?

    x = X cos(a) - Y sin(a)

    y = Y cos(a) + X sin(a)

  • cincipon, Do you mean x=center.x*cos(a)-center.y*sin(a) ?

    Is there any constant or variable for orbiting speed?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • He means this:

    global number X = 0

    global number Y = 0

    global number a = 45

    X = cos(time*300)*200

    Y = sin(time*300)*300

    Object.x = X*cos(a) - Y*sin(a) + center.x

    Object.y = Y*cos(a) + X*sin(a) + center.y

  • docs.google.com/file/d/0B-6JjcHcczubZGc1RGtDbF9Dbnc/edit

    That should link to a capx demonstrating. t is the step, or speed, theta is angle of rotation, a is one axis of the ellipse, b is the other

    The initial transformation I posted rotates about the origin, so this new one is corrected for that.

    The parametric equation is:

    X(t) = Xc + a * cos(t) * cos(theta) - b * sin(t) * sin(theta)

    Y(t) = Yc + a * cos(t) * sin(theta) + b *sin(t) * cos(theta)

    AND OMG I NEED TO REFRESH MY TRIG. Thanks for pointing out a glaring weakness of mine. :(

  • Thanks guys it works perfect! complicated and out of my brain though xD

  • Don't sell yourself short! And also, trig is supremely useful in any video game development. Worth the investment of time if you're at all serious about making images move/stretch/rotate.

  • cincipon - would you happen to be able to post a working example like you did before? That link leads to a file that has nothing to do with this question.

    Is there anywhere on the web you could point me to where I could learn about more 'gamey' maths stuff like this? I know that I might be able to just copy and paste and fiddle to get it working, but I'd rather really understand the maths behind it!

    Cheers.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)