Skip to content
Simon (darkside) Jackson edited this page Aug 21, 2020 · 7 revisions

Aiming

Area Submitted Type
Games: Artificial Intelligence, Games: Math 5/26/2010 Code Sample

Description

This sample shows how to turn one object to face another. This can be useful for aiming, for example.

Sample Overview

This sample shows how to use trigonometry to make one 2D object aim towards another object as fast as it can. This can be useful when making spotlights, gun turrets, and more.

The function TurnToFace does the hard work in this sample. You can copy it and use it in your game.

All content and source code downloaded from this page are bound to the Microsoft Permissive License (Ms-PL).

Download Size Description
AimingSample_4_0 0.06MB Source code and assets for the Aiming Sample (XNA Game Studio 4.0).
AimingSample_4_0.zip 0.06MB Source code and assets for the Aiming Sample (XNA Game Studio 4.0).
Clone this wiki locally