Search:

Type: Posts; User: helloworld922

Search: Search took 0.08 seconds.

  1. Replies
    9
    Views
    1,567

    [SOLVED] Re: Need help with motion direction

    setFocusable() should only allow you to focus a component, not transfer the focus to that component.

    I'm not positive on the focus system in Java, but I believe calling requestFocusInWindow() will...
  2. Replies
    9
    Views
    1,567

    [SOLVED] Re: Need help with motion direction

    You're keeping track of the projectile's position, correct? At a given time step, simply keep updating it's position (this is a numerical integration).

    position.x = position.x + velX * time_step...
  3. Replies
    9
    Views
    1,567

    [SOLVED] Re: Need help with motion direction

    It really boils down to a few equations:

    The ball's initial x and y velocity is this:

    Vx_0 = V * cos(theta)
    Vy_0 = V * sin(theta)

    where theta is the angle in radians and V is the magnitude...
  4. Replies
    9
    Views
    1,567

    [SOLVED] Re: Need help with motion direction

    There is a simple trigonometric relationship between the angle and the x/y velocity of the projectile. I would suggest reading Projectile motion - Wikipedia, the free encyclopedia.
Results 1 to 4 of 4