Posted by
December 18th, 2010 10:15 am

I had a bunch of problems with the maths of my game that I really cant solve at the moment, so I am quitting.

9 Responses to “sorry”

  1. madk says:

    Share the problem, maybe we can help

    • alfie275 says:

      Basically it was a problem with:
      A)Rotating the ship relative to its current rotation
      B)Making the ship go forwards relative to its rotation

      And I’ve spent like all my time on this problem, I dont think I could get any gameplay intime.

  2. madk says:

    It’s simple trigonometry.

    in pseudocode:

    int ship_angle
    int ship_speed
    int ship_x
    int ship_y
    if key_left then ship_angle–
    if key_right then ship_angle++
    if key_forward then
    end if

  3. alfie275 says:

    No, in 3d. See the problem?

  4. madk says:

    All that is necessary is a small adjustment.

    Given X is side-to-side, Y is height, and Z is depth

    int ship_pitch
    int ship_yaw
    //only two axes are necessary. disregard roll.
    int ship_speed
    int ship_x
    int ship_y
    int ship_z
    if key_left then ship_yaw–-
    if key_right then ship_yaw++
    if key_up then ship_pitch–
    if key_down then ship_pitch++
    if key_forward then
    end if

    I haven’t dealt with 3D trig in a while, so I might have one or two things off by a bit, but that’s the idea.

  5. alfie275 says:

    The actual axis change depending on the rotation of the ship.

  6. madk says:

    I’m afraid I don’t understand what you’re trying to say.

  7. alfie275 says:

    I mean, if you roll the pitch becomes yaw.

  8. madk says:

    Then I believe this is how you’d go about it:


Leave a Reply

You must be logged in to post a comment.

[cache: storing page]