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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:00:29+00:00 2026-05-21T04:00:29+00:00

I’m working on collision detection for a game written using the Microsoft XNA framework

  • 0

I’m working on collision detection for a game written using the Microsoft XNA framework version 4.0. When trying to access the model itself once it’s been loaded by the content framework, I can access a list of “ModelMesh”es, and for each one a list of MeshParts, but the parts only seem to have diagnostic data like the number of vertices. I’m completely stumped as to what’s happened to the actual face data for the model.

I’m trying to implement sphere-sweep/plane collision– that is, I have a ball moving and I’d like to test collision with a polygon as the ball moves. I need a way to define all the polygons to test with, and it just makes sense to me to define a collision map as a simplified mesh that I design in parallel with my actual graphics object to use for the colliding, but I’m completely baffled as to how I’m supposed to access that info once XNA’s content pipeline has loaded it.

Some insight here perhaps? I’ve been combing Google all day and I’m unable to locate anything that might help, although it’s possible that I’m using the wrong search terms…

  • 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-05-21T04:00:30+00:00Added an answer on May 21, 2026 at 4:00 am

    The built-in XNA FBX/model content importer and processor handle “faces” the same way that just about every modeling program out there does – as lists of vertices and indices. (As a side note, your GPU also natively supports this scheme, and modern games rely upon it for performance reasons.)

    For instance, consider a simple, two-triangle quad. The vertices might be:

    v0 (0,0,0)
    v1 (1,0,0)
    v2 (1,1,0)
    v3 (0,1,0)
    

    or,

    v0--v1
    |  / |
    | /  |
    v3--v2
    

    To represent this in “face” form, you’d need a list of data equivalent to

    triangle 1 (upper-left): (0,0,0),(1,0,0),(0,1,0) = (v0,v1,v3)

    triangle 2 (lower-right): (1,0,0),(1,1,0),(0,1,0) = (v1,v2,v3)

    which requires six vertex records.

    Using XNA-native structures, a Vector3 has three elements, each of which are single-precision floats (4 bytes), so that’s 3*4=12 bytes each, and you need six of them, so that 72 bytes.

    Or, you can use indexing. In addition to the four vertices, you store a list of indices:

    f1: 0,1,3
    f2: 1,2,3
    

    Indices can be stored using shorts (16-bit integers). So, let’s examine the difference:

    No indices: two faces * 3 vertices*3 components (xyz) * 4 bytes each = 2*3*3*4=72 bytes.

    Indexed:

    vertices: 4 vertices * 3 components each * 4 bytes per component = 48 bytes,

    indices (3 shorts per triangle): 6 indices * 2 bytes each = 12 bytes.

    48 + 12 = 60, which is slightly less than 72 bytes for the non-indexed model.

    That 12 bytes might not seem like a lot until you consider an entire level with 100,000+ triangles. At that point, you’re looking at a 1.2MB difference. Although your graphics card may about 2+GB of memory, moving that data back and forth between host RAM and GPU RAM is expensive.

    So, how do you get that data?

    Look at Model.Meshes[].MeshParts[].VertexBuffer.GetData() and Model.Meshes[].MeshParts[].IndexBuffer.GetData(). You can use those methods to extract the vertices and indexes, then cross-reference the two to get the triangle list.

    You can’t just directly access the elements of VertexBuffer and IndexBuffer because they are stored in the GPU’s RAM – allowing random element access would drag performance to near-negative velocity.

    Also, have a look at the GraphicsDevice.DrawIndexedPrimitives() method.

    I can post some example code later if necessary.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.