mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix Android node selection distance (#6187)
This commit is contained in:
parent
397a701f98
commit
01c319d778
@ -3544,6 +3544,9 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
|
|||||||
|
|
||||||
if ((g_settings->getBool("touchtarget")) && (g_touchscreengui)) {
|
if ((g_settings->getBool("touchtarget")) && (g_touchscreengui)) {
|
||||||
shootline = g_touchscreengui->getShootline();
|
shootline = g_touchscreengui->getShootline();
|
||||||
|
// Scale shootline to the acual distance the player can reach
|
||||||
|
shootline.end = shootline.start
|
||||||
|
+ shootline.getVector().normalize() * BS * d;
|
||||||
shootline.start += intToFloat(camera_offset, BS);
|
shootline.start += intToFloat(camera_offset, BS);
|
||||||
shootline.end += intToFloat(camera_offset, BS);
|
shootline.end += intToFloat(camera_offset, BS);
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,14 @@ public:
|
|||||||
|
|
||||||
double getPitch() { return m_camera_pitch; }
|
double getPitch() { return m_camera_pitch; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns a line which describes what the player is pointing at.
|
||||||
|
* The starting point and looking direction are significant,
|
||||||
|
* the line should be scaled to match its length to the actual distance
|
||||||
|
* the player can reach.
|
||||||
|
* The line starts at the camera and ends on the camera's far plane.
|
||||||
|
* The coordinates do not contain the camera offset.
|
||||||
|
*/
|
||||||
line3d<f32> getShootline() { return m_shootline; }
|
line3d<f32> getShootline() { return m_shootline; }
|
||||||
|
|
||||||
void step(float dtime);
|
void step(float dtime);
|
||||||
@ -178,6 +186,12 @@ private:
|
|||||||
double m_camera_yaw_change = 0.0;
|
double m_camera_yaw_change = 0.0;
|
||||||
double m_camera_pitch = 0.0;
|
double m_camera_pitch = 0.0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* A line starting at the camera and pointing towards the
|
||||||
|
* selected object.
|
||||||
|
* The line ends on the camera's far plane.
|
||||||
|
* The coordinates do not contain the camera offset.
|
||||||
|
*/
|
||||||
line3d<f32> m_shootline;
|
line3d<f32> m_shootline;
|
||||||
|
|
||||||
int m_move_id = -1;
|
int m_move_id = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user