Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not exactly a straight answer to your question, but perhaps you find this relevant. </p> <p>Have you considered constructing a BoundingBox object and use the Intersects(Ray)? <a href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.boundingbox.intersects.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.boundingbox.intersects.aspx</a></p> <p>Edit 1: It's how I usually do it. Depending on your data structure, it might also be easier to optimize (if you construct larger bounding boxes to bore into for example).</p> <p>Edit 2: As per Niko's suggestion: I don't want to post the relevant code (because it's a couple of pages long in total to make the context make sense) from the samples, but I can point you to the parts that you'll be interested in.</p> <ol> <li>Download the sample from <a href="http://xbox.create.msdn.com/en-US/education/catalog/sample/picking_triangle" rel="nofollow">http://xbox.create.msdn.com/en-US/education/catalog/sample/picking_triangle</a></li> <li>The bottom of the Cursor.cs file contains what you already know, calculating the Ray</li> <li>Go to the Game.cs file. There you'll find UpdatePicking() which calls RayIntersectsModel(...) which calls RayIntersectsTriangle(...)</li> </ol> <p>The transform of the Ray is this part:</p> <pre><code>Matrix inverseTransform = Matrix.Invert( modelTransform ); ray.Position = Vector3.Transform( ray.Position, inverseTransform ); ray.Direction = Vector3.TransformNormal( ray.Direction, inverseTransform ); </code></pre> <p>How deep you want to go (how accurate your picking) is up to your needs of course, but there you have it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload