Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:43:52+00:00 2026-06-17T19:43:52+00:00

I am currently creating an android game and implemented collision detection a while back.

  • 0

I am currently creating an android game and implemented collision detection a while back. I am simply drawing a Rect around sprites using their position, width and height and seeing if they intersect other Rects. However, my sprites now rotate depending on their trajectory, but I cannot find how to rotate the Rect so the bound is correct. Any suggestions?

Thanks
Andy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:43:54+00:00Added an answer on June 17, 2026 at 7:43 pm

    Rect objects are usually axis-aligned, and so they only need 4 values: top, left, bottom, right.

    If you want to rotate your rectangle, you’ll need to convert it to eight values representing the co-ordinate of each vertex.

    You can easily calculate the centre value by averaging all the x- and y-values.

    Then it’s just basic maths. Here’s something from StackOverflow:

    Rotating a point about another point (2D)

    Your eight values, or four corners are (assuming counter-clockwise from the top right):

    v0 : (right, top)
    v1 : (left, top)
    v2 : (left, bottom)
    v3 : (right, bottom)
    

    Create your own rectangle object to cope with this, and compute intersections etc.

    Note that I’ve talked about how to rotate the rectangle’s vertices. If you still want a bounding box, this is normally still considered to be axis-aligned, so you could take the max and min of the rotated vertices and construct a new (larger) rectangle. That might not be what you want though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently creating a tile-based game for android. Using java via dalvik JVM. im
Im creating a space shooter game for android, im currently implementing the shooting methods
I'm new to developing apps in Android. We are currently creating a robot using
I am creating an android game using opengl and a cocos2d port (http://code.google.com/p/cocos2d-android-1). I
I am currently creating an Android app that requires using the Android phone's name
I am new on android development, and i was currently creating an application using
so here is the problem. I am currently creating an Android app that is
I'm currently creating my first android app and I've a simple class 'Player' I
I'm currently creating a payment SDK for android, as such I want to send
I'm currently working on creating a Download Manager for Android. In order to optimize

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.