1
\$\begingroup\$

So I'm pretty new to DirectX, currently going through some tutorials to get an understanding of it. Now that I'm getting a small grasp onf graphics programming, I'm wondering how simple AABB bounding box collision would work, if the Z factor on quads was being changed for a zoom effect.

Say I have 2 quads set up, a texture applied to both, a bounding box around each and their positions set overlapping each other. I have an orthographic camera set up. Will zooming in scale the textures and quads so the boxes around them are no longer representative of them?

\$\endgroup\$
7
\$\begingroup\$

It shouldn't have any impact.

You should not be implementing zoom by scaling or otherwise messing with 'the Z factor' (whatever that is) of your objects in the world. You should be implementing zoom by adjusting properties of the camera and projection (field of view, camera position). The camera and projection properties only come into play when you transform objects from world space to eye and then eventually clip space.

All of your collision, in contrast, will generally be done in world space (or earlier). Thus, "zooming in" on objects should have no impact on the collision geometry at the point at which collision is detected.

\$\endgroup\$
  • \$\begingroup\$ What i meant by the Z factor was increasing or decreasing the z part of position in the following: D3DXMatrixLookAtLH(&m_viewMatrix, &position, &lookAt, &up); I thought doing so would be an acceptable way to accomplish zoom, i just didnt know how it would affect the collision geometry. \$\endgroup\$ – Jake May 31 '16 at 16:34
  • 1
    \$\begingroup\$ You're altering the view matrix there ('moving the camera'), so it should not factor into your collision detection. Even if you did, for some reason, do your collision in view space, it would be fine since you transform the AABB into whatever space you do the collision in. \$\endgroup\$ – Josh May 31 '16 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.