June 2013
Beginner
352 pages
9h 5m
English
Now your player can click items, but how do you find out what he clicked? In principle, we can use the same ray casting algorithm as for the previous example with the crosshairs. Only instead of casting the ray from the camera forward, we now cast it forward from the 3D coordinates of the click location.
AnalogListener object on the Analog() method to test for our left-click action, MAPPING_ROTATE.private AnalogListener analogListener = new AnalogListener() {
public void onAnalog(String name, float intensity, float tpf) {
if (name.equals(MAPPING_ROTATE)) {
// implement action here
}
}
};Read now
Unlock full access