<commit_before>= jMonkeyEngine 3 Tutorial (8) - Hello Picking
:author:
:revnumber:
:revdate: 2020/07/06
:keywords: beginner, documentation, intro, node, ray, click, collision, keyinput, input


Typical interactions in games include shooting, picking up objects, and opening doors. From an implementation point of view, these apparently different interactions are surprisingly similar: The user first aims and selects a target in the 3D scene, and then triggers an action on it. We call this process picking.

You can pick something by either pressing a key on the keyboard, or by clicking with the mouse. In either case, you identify the target by aiming a ray –a straight line– into the scene. This method to implement picking is called _ray casting_ (which is not the same as _ray tracing_).

This tutorial relies on what you have learned in the <<jme3/beginner/hello_input_system#,Hello Input>> tutorial. You find more related code samples under <<jme3/advanced/mouse_picking#,Mouse Picking>> and <<jme3/advanced/collision_and_intersection#,Collision and Intersection>>.


image::jme3/beginner/beginner-picking.png[beginner-picking.png,width="",height="",align="center"]



== Sample Code

[source,java]<commit_msg>change to xref<commit_after>= jMonkeyEngine 3 Tutorial (8) - Hello Picking
:author:
:revnumber:
:revdate: 2020/07/06
:keywords: beginner, documentation, intro, node, ray, click, collision, keyinput, input


Typical interactions in games include shooting, picking up objects, and opening doors. From an implementation point of view, these apparently different interactions are surprisingly similar: The user first aims and selects a target in the 3D scene, and then triggers an action on it. We call this process picking.

You can pick something by either pressing a key on the keyboard, or by clicking with the mouse. In either case, you identify the target by aiming a ray –a straight line– into the scene. This method to implement picking is called _ray casting_ (which is not the same as _ray tracing_).

This tutorial relies on what you have learned in the xref:beginner/hello_input_system.adoc[Hello Input] tutorial. You find more related code samples under xref:ROOT:jme3/advanced/mouse_picking.adoc[Mouse Picking] and xref:ROOT:jme3/advanced/collision_and_intersection.adoc[Collision and Intersection].


image::jme3/beginner/beginner-picking.png[beginner-picking.png,width="",height="",align="center"]



== Sample Code

[source,java]
{'fraction_non_alphanumeric': 0.07520325203252033, 'fraction_numerical': 0.011788617886178862, 'mean_word_length': 5.527851458885942, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5392558', 'n_tokens_mistral': 692, 'n_tokens_neox': 645, 'n_words': 305}