Results 1 to 9 of 9

Thread: Need help with physics/math

  1. #1
    Lord of Death jubeh's Avatar
    Join Date
    Dec 2010
    Location
    Space
    Posts
    12,695

    Need help with physics/math

    I'm working on a baseball game and in order for the AI to work properly I need to be able to tell where the ball will land based on its speed and direction. The problem is my bat/ball interface is completely physics based and doesn't use static trajectories like most baseball games so every time you hit the ball it could go anywhere (based on a number of factors).

    Any ideas?

  2. #2
    Teen Member mop's Avatar
    Join Date
    Feb 2012
    Location
    Arizona
    Posts
    22
    Well I wish I could help, but it would sure be a lot easier to do so if you provided information such as what program you're developing this game with, and what code language or interface you're writing it in. It would also help to see the mathematical formulas involved in your physics engine.

    But based off what you've said so far, I guess your best bet would be to just redo the system to incorporate static trajectories. :/

  3. #3
    Lord of Death jubeh's Avatar
    Join Date
    Dec 2010
    Location
    Space
    Posts
    12,695
    Quote Originally Posted by Serenade View Post
    Well I wish I could help, but it would sure be a lot easier to do so if you provided information such as what program you're developing this game with, and what code language or interface you're writing it in. It would also help to see the mathematical formulas involved in your physics engine.
    Game Maker and the physics "engine" is mind numbingly simple, I just don't understand physics in general. Basically once the bat contacts the ball, depending on the timing of the swing and the bat's height vs the ball's height the ball will take off. There is no spin on the balls and there is only air resistance and no wind.

    The rise of the ball is based on bat position, whereas the horizontal angle is based on timing. I could post up the exe if need be.

    But based off what you've said so far, I guess your best bet would be to just redo the system to incorporate static trajectories. :/
    My intent wasn't really to create a baseball game when I started this, but to simply emulate puwapuro/yakyuu spirit's batting system so that would go against the purpose of the project unfortunately.
    Last edited by jubeh; 03-05-2012 at 04:27 AM.

  4. #4
    Three Trio Tres Member Rubisko's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    346
    State the factors you want to use, and I might be able to help. Also, i guess you want to know where it will land on an area, am I right?

    Edit: Saw your last post now, I'll see if I can come up with something about the distance

    Edit2: Made this
    SPOILER! :
    , it shows the basic stuff. Realised that you can find all this, better explained than I could ever do on Khan Academy, and sure enough: http://www.khanacademy.org/science/p...le-at-an-angle

    ask away if you need clarification on anything. Mechanics is not really my thing, but it's basic engineering stuff this, so even a teconomist such as my self should be able to help you.
    Last edited by Rubisko; 03-05-2012 at 05:01 AM.

  5. #5
    Ruler of the Seventh Empire GunZet's Avatar
    Join Date
    Jan 2011
    Location
    Preparing the laser beam, we're gonna use it tonight.
    Posts
    11,873
    You're looking to get a lot of math answers, Jubes. If you're using Gamemaker, this is something completely different, as the physics are more than likely calculated in that language, or in the format of the engine you're using. I've screwed around with a few physics engines in some of my games, and most of the time they offer rigid bodies, see if you can use those, and look for a few functions hinting at force, velocity, etc.

    Meaning, if you can find those functions, you can give the ball a velocity, and the bat a force on contact, and take the ball's velocity and the bat's force into account. I'd try and figure this all out, but I'm shit at actual math, and haven't touched GM in about a year or so, lol.

    Try asking this in the GMC forum too.
    <My comic
    .................................................. ......................."Mind-controlling you into thinking this is awesome."

  6. #6
    ハリセン クラプ Ace Pitcher Hayashida's Avatar
    Join Date
    Nov 2010
    Location
    PEPSI
    Posts
    9,086
    C'mon James this stuff is so obvious

  7. #7
    Lord of Death jubeh's Avatar
    Join Date
    Dec 2010
    Location
    Space
    Posts
    12,695
    I plugged in your number rubisko but game maker wasn't having it. I think it's because the built in speed variables are bad and when I did get it to work it went backwards on the X axis. Guess I have to switch over to static trajectories. I'll just have to account for a butt ton of results.

  8. #8
    Ruler of the Seventh Empire GunZet's Avatar
    Join Date
    Jan 2011
    Location
    Preparing the laser beam, we're gonna use it tonight.
    Posts
    11,873
    You don't just plug math into GM, bro. You gotta do it so that the framework understands it.
    <My comic
    .................................................. ......................."Mind-controlling you into thinking this is awesome."

  9. #9
    Lord of Death jubeh's Avatar
    Join Date
    Dec 2010
    Location
    Space
    Posts
    12,695
    I did, son, but I was using gm's built in speed function cuz I never thought this would balloon into such a big thing and now I really don't feel redoing everything.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •