gummipalle's Profile User Rating: -----

Reputation: 0 Apprentice
New Members
Active Posts:
10 (0.01 per day)
23-January 13
Profile Views:
Last Active:
User is offline Jan 29 2013 06:30 AM

Previous Fields

Dream Kudos:
Icon   gummipalle has not set their status

Posts I've Made

  1. In Topic: XNA Hit "prediction" instead of "detection"?

    Posted 28 Jan 2013

    Yeah, thats actually my source for what I had...

    Well, these last couple of days I've been thinking of scrapping this stuff anyways,
    burrying it, and starting from scratch... Re-think it... Just had so much time invested in it,
    making it hard to let go...But seems I'm getting nowhere... So... Yeah...

    Well thanks for your time and effort this time around... I'm off to meet square 1, an old friend from way back... :-)

  2. In Topic: XNA Hit "prediction" instead of "detection"?

    Posted 28 Jan 2013

    Man you are fast!

    ok, thought I initially needed all pixels simply to determine/test which of them are on the circumferance...
    Then I'd throw the others away...


    You know the center and diameter you can use a basic math formula to get any point.

    I think thats what I might be looking for, all i have is this to test Yes/No against, for every pixel:

    (x - x_0)^2 + (y - y_0)^2 = r^2\,

    which is not yielding good results for me...

    If you know the name of a formula, or can point me in its direction, I'll read up on that.

    May be slow on my next post, trying to get what you are saying... I'm snow-blind from looking at my old code for so long...

    Just remembered, I think my trouble may stem from coordinates on the cirle not exactly matching pixel-coordinates on the screen, if that makes sense...
  3. In Topic: XNA Hit "prediction" instead of "detection"?

    Posted 28 Jan 2013

    Ughhh.... Pasted code above looks bad on my screen at least, but I cant find an edit function?
    Help me find it, and I'll make it look better... (It looks neater in my Visual-express editor.)
    Also, cant see pictures without right-clicking on the text that says 'posted image', and selecting 'display image', which is not as cool as yours... Did my best...
  4. In Topic: XNA Hit "prediction" instead of "detection"?

    Posted 28 Jan 2013

    Ok, here is my second try at explaining what I'm trying to accomplish:

    I want to trace every pixel on the balls circumference in the
    direction fired, and using the given velocity of the ball, determine
    "time until impact" for each of these pixels, against whatever brick or wall pixels
    that stand in the way.
    The pixel with the least "time until impact" will then represent the
    "point of impact" on the ball. (Red circle on picture 1)

    Knowing the point of impact on the ball, because each pixel has a unique position on the circle,
    and therefore also a unique "direction towards ball centre",
    I can then determine the new travel direction for the ball. See picture 1....
    Posted Image

    Information about each pixel (both ball and bricks) is stored as vectors.
    because the ball has a dynamic size, its "vector list" (list of pixels on circle) must also be dynamic.
    However, when generating this list, on game load or size change,
    I come up short... There are gaps in the circle.
    See picture 2..

    Posted Image

    What I need is something like this: I put in a radius (or diameter) for the ball, (So the ball sprite is real-time scalable)
    and the program generates a list of pixel-positions that completely cover the circle, without gaps,
    or at least without gaps much bigger than 1 pixel, or else small bricks (I want that option) might pass through the ball, undetected.

    Here is the code I've been using to generate this list of pixels.
    Note: This is one of many similar models I've used in attempting this. It may not be the
    most accurate variant, but it should convey the basic thought-process...
    It basically lists all pixels in the rectangle, and tests each one for being in ther circle, adding
    positives to a list, which I can use for collision detection...

            //>>>>>>>>>>>>>>>>>>>>>>>>>>  Define Circle    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            //heights list is used internally by the code to count the height of the ball, and make
            //a row for each that is as wide as the ball.
            List<int> heights_list = new List<int>();
            //This is a list of all the border oixels of the ball...
            public List<Vector4> all_ball_pixels = new List<Vector4>();
            private void Define_Cirkel()
                /* so ok... For every pixel in ball, make a vector...
                 * of these vectors, check for "being on the cirkel"
                 * Those one the cirkel are added to ball_pixel_list
                //This is the amount of pixels that need a vector assigned...
                int ball_pix_counter = (int)ball_diameter * (int)ball_diameter;
                //First we create a list of heights, so that we can use a foreach loop on - each of them,
                //that adds a vector for every width.
                float heightcounter = ball_diameter;
                float widthcounter = ball_diameter;
                while (heightcounter >= 0)
                //Now you have a list of ints, which in themselves represent each variance of height 
                //used by the ball. Now, for each of these items, create width amount of vectors.
                foreach (float heights in heights_list)
                    widthcounter = ball_diameter;
                    while (widthcounter >= 0)
                        if (((int)Math.Floor((widthcounter - ball_diameter / 2) * (widthcounter - ball_diameter / 2)) + ((int)Math.Floor(heights - ball_diameter / 2) * (heights - ball_diameter / 2))) >= (int)Math.Floor((ball_diameter / 2) * (ball_diameter / 2)) -4//-6f)
                         && ((int)Math.Floor((widthcounter - ball_diameter / 2) * (widthcounter - ball_diameter / 2)) + ((int)Math.Floor(heights - ball_diameter / 2) * (heights - ball_diameter / 2))) <= (int)Math.Floor((ball_diameter / 2) * (ball_diameter / 2)) +4)
                            float direction_to_center = MathHelper.ToDegrees( (float)Math.Atan2(widthcounter, ball_diameter - heights) );
                            //we only add the vectors that represent points on the circumferance of the ball...
                            //we dont need an ID# per say, we need an "angle to center", becouse this will be used to find new course.
                        all_ball_pixels.Add(new Vector4( ((int)widthcounter) + (int)Math.Floor( position_X) , (int)Math.Floor(position_Y) + ((int)heights), direction, direction_to_center ) );
                is_defined = true;

My Information

Member Title:
New D.I.C Head
Age Unknown
Birthday Unknown

Contact Information



gummipalle hasn't added any friends yet.


gummipalle has no profile comments yet. Why not say hello?