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

  • SEARCH
  • Home
  • 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 8071459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:41:55+00:00 2026-06-05T13:41:55+00:00

Say I have multiple objects laying on each other, if I click on one

  • 0

Say I have multiple objects laying on each other, if I click on one of them, the coordinates returned from TouchPanel.GetState() would not able to tell me which object is selected. The object is not necessary the top most one. In this case, do I organize the list of objects so that sorted by Z value and compare Rectangles from top to bottom. Is this right way to do that? Or if there is any UI framework providing some sort of component to inherit so that the object will have callback when there is external event happening?

  • 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-05T13:41:56+00:00Added an answer on June 5, 2026 at 1:41 pm

    If you’re using the XNA Game Libraries, you’re going to have to use a Z value to determine which object was selected.

    XNA’s TouchPanel.GetState() will only return the position of the fingers on the screen, it won’t tell you which objects it’s colliding with. You have to do all that collision checking yourself, which is where you can decide via Z or layering order, which object you’d like to select.

    For 2D objects, there isn’t any specific Z order applied to them (because they’re 2D, not 3D), so you’ll need to add a property to handle that to your object’s class.

    Then when you touch a position, you can collect all of the objects that the position collided with and select whichever object you want based on it’s z order.

    Hope that helps!

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

Sidebar

Related Questions

Say that I have an article with multiple pages. Each page has a short
Lets say you have a FooManager made to manage multiple objects of type Foo
Let's say I have a program(C++, for example) that allocates multiple objects, never bigger
Say I have several objects within a class, each of which needs constructing with
Let's say I have multiple Objects to be stored: Person ------------ Employee ------------ Sales
I've got an observable collection that contains multiple DocumentEntry objects that each have a
Lets say I have multiple DataGrids throughout my winform app and I want to
Let's say you have multiple directories that all exist on the same partition. Let's
I have multiple Matlab versions installed on my PC. To say, R2006b, R2009b, R2010a.
Let's say I have a site with multiple links as follows: www.example.com/product/1 www.example.com/product/2 www.example.com/product/3

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.