Picking up an item in the scene while the mouse is locked and hidden
While the mouse is locked and hidden, such as during a typical first-person shooter game where the mouse position is locked as the targeting reticle, there are times when the player needs to interact with the environment in a means other than colliding with it. For example, we may want to pick up a cache of ammo we are looking at, or activate a switch. In this recipe, we will pick up an object on the ground based on where the player is looking.
Getting ready
We will be making TorqueScript changes in a project based on the Torque 3D Full
template, and try them out using the Empty Terrain
level. If you haven't already, use the Torque Project Manager (Project Manager.exe
) to create a new project from the Full
template. It will be found under the My Projects
directory.
How to do it...
In the following steps we will add some objects to the scene and allow the user to pick them up by pressing a key while looking at an object:
We...