Skip to content

Picking

Chuck Walbourn edited this page Apr 24, 2020 · 8 revisions

This lesson covers performing picking in 3D.

Ray casting

You can find an older tutorial on 3D picking using ray/object tests at Rastertek that uses the deprecated D3DXMath library. Note that instead of a 'roll your own' RaySphereIntersect you can use BoundingSphere from DirectXCollision.h with the following method to do the ray-sphere test:

bool Intersects(FXMVECTOR Origin, FXMVECTOR Direction, float& Dist) const;

Also remember that the default view coordinates for DirectX Tool Kit is "right-handed" viewing coordinates and the Rastertek tutorials follow the older DirectX style of "left-handed" viewing coordinates. This requires reversing the Z direction of the ray.

Next lesson: Mixing SimpleMath and DirectXMath

Further reading

DirectMath Programmer's Guide
DirectXMath Collision sample

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Xbox One

Architecture

  • x86
  • x64
  • ARM64

For Development

  • Visual Studio 2022
  • Visual Studio 2019 (16.11)
  • clang/LLVM v12 - v18
  • MinGW 12.2, 13.2
  • CMake 3.20

Related Projects

DirectX Tool Kit for DirectX 12

DirectXMesh

DirectXTex

DirectXMath

Win2D

Tools

Test Suite

Model Viewer

Content Exporter

DxCapsViewer

Clone this wiki locally