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 145721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:28:26+00:00 2026-05-11T08:28:26+00:00

With reference to this programming game I am currently building. Thanks to the answers

  • 0

With reference to this programming game I am currently building.

Thanks to the answers from this post, I am now able to find the x-y coordinates of all the points of the rectangles (even when rotated), and Collision-Detection with Walls is almost working perfectly now.

Now I need to implement collision detection with the bots themselves (cause obviously, there will be more than one bot in the Arena).

Square-Square Collision Detection (Non-rotated) is not valid in this case because the bots will be turned at an angle (just like I described here).

So what is the best way to implement this form of Rotated Rectangles Collision Detection in WPF?

I guess there must be some math involved, but usually it turns out that there are functions in WPF that ‘calculate’ these maths for you (just like in this case)

  • 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. 2026-05-11T08:28:26+00:00Added an answer on May 11, 2026 at 8:28 am

    Solution

    By using the method I posted as a solution to this previous question and a WPF method called IntersectsWith (from Rect), I was able to solve this issue of rotated rectangles collision detection like so:

    public Rect GetBounds(FrameworkElement of, FrameworkElement from) {         // Might throw an exception if of and from are not in the same visual tree         GeneralTransform transform = of.TransformToVisual(from);          return transform.TransformBounds(new Rect(0, 0, of.ActualWidth, of.ActualHeight)); }  Vehicle IsBotCollided(IEnumerable<Vehicle> blist) {     //currentBounds is of type Rect, which contains the 4 points of the rectangle (even when rotated)     var currentBounds = GetBounds(BotBody, BattleArena);      //Then I check if the current bounds intersect with each of the other Bots` bounds that are also in the Arena     foreach (Vehicle vehicle in blist)     {         if(GetBounds(vehicle.BotBody, BattleArena).IntersectsWith(currentBounds))         {             return vehicle;         }     }     return null; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With reference to this programming game I am currently building. I wrote the below
With reference to this programming game I am currently building. I have a Class
With reference to this programming game I am currently building. When the game is
With reference to this programming game I am currently building. Important: Scroll down to
With reference to this programming game I am currently building. alt text http://img12.imageshack.us/img12/2089/shapetransformationf.jpg To
With reference to this programming game I am currently building. I am using WPF
I'm currently creating an explicit reference to this in the outer class so that
I'm trying to find any reference for this function, but I haven't found anything.
I found this paragraph in the Intel developer manual: From the chaper PROGRAMMING WITH
With reference to this MSDN article , at the end (Section: Robust Programming) it

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.