Well, I was looking for something to check if objects in a game collide.

I guess this is the closest I could find:  (in the Rect class):

    /**
     * If the rectangle specified by left,top,right,bottom intersects this
     * rectangle, return true and set this rectangle to that intersection,
     * otherwise return false and do not change this rectangle. No check is
     * performed to see if either rectangle is empty. Note: To just test for
     * intersection, use {@link #intersects(Rect, Rect)}.
     *
     * @param left The left side of the rectangle being intersected with 
this
     *             rectangle
     * @param top The top of the rectangle being intersected with this 
rectangle
     * @param right The right side of the rectangle being intersected with 
this
     *              rectangle.
     * @param bottom The bottom of the rectangle being intersected with this
     *             rectangle.
     * @return true if the specified rectangle and this rectangle intersect
     *              (and this rectangle is then set to that intersection) 
else
     *              return false and do not change this rectangle.
     */
*    public boolean intersect(int left, int top, int right, int bottom) {*
*        if (this.left < right && left < this.right && this.top < bottom && 
top < this.bottom) {*
*            if (this.left < left) this.left = left;*
*            if (this.top < top) this.top = top;*
*            if (this.right > right) this.right = right;*
*            if (this.bottom > bottom) this.bottom = bottom;*
*            return true;*
*        }*
*        return false;*
*    }*

Thanks.


On Friday, March 25, 2011 8:33:57 PM UTC-5, Hari Edo wrote:
>
>
> On Mar 25, 8:36 pm, bob <[email protected]> wrote: 
> > Does android have any libraries to help with collision detection? 
>
> Not going to give us much to go on, right?  What do you mean? 
> Phone-hits-pavement, finger-thumps-phone, finger-taps-widget, 
> circle-intersects-with-circle, rectangle-intersects-with-line, 
> sphere-intersects-with-ray, mesh-intersects-with-mesh, what? 
>
> Actually, I guess the answer is simpler than the question. 
> In all but one of those cases, the answer is generally "no." 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to