1
0
mirror of https://github.com/minetest/minetest.git synced 2025-06-30 23:20:22 +02:00

Raycast: export exact pointing location (#6304)

* Return intersection point in node coordinates.
* Clarify 'intersection_point' documentation
This commit is contained in:
Dániel Juhász
2018-08-16 20:10:08 +02:00
committed by SmallJoker
parent 798724efea
commit 325bf68041
9 changed files with 63 additions and 17 deletions

View File

@ -25,13 +25,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
PointedThing::PointedThing(const v3s16 &under, const v3s16 &above,
const v3s16 &real_under, const v3f &point, const v3s16 &normal,
f32 distSq):
u16 box_id, f32 distSq):
type(POINTEDTHING_NODE),
node_undersurface(under),
node_abovesurface(above),
node_real_undersurface(real_under),
intersection_point(point),
intersection_normal(normal),
box_id(box_id),
distanceSq(distSq)
{}

View File

@ -64,7 +64,8 @@ struct PointedThing
s16 object_id = -1;
/*!
* Only valid if type isn't POINTEDTHING_NONE.
* First intersection point of the ray and the nodebox.
* First intersection point of the ray and the nodebox in irrlicht
* coordinates.
*/
v3f intersection_point;
/*!
@ -74,9 +75,14 @@ struct PointedThing
* points outside of the box and it's length is 1.
*/
v3s16 intersection_normal;
/*!
* Only valid if type isn't POINTEDTHING_NONE.
* Indicates which selection box is selected, if there are more of them.
*/
u16 box_id = 0;
/*!
* Square of the distance between the pointing
* ray's start point and the intersection point.
* ray's start point and the intersection point in irrlicht coordinates.
*/
f32 distanceSq = 0;
@ -85,7 +91,7 @@ struct PointedThing
//! Constructor for POINTEDTHING_NODE
PointedThing(const v3s16 &under, const v3s16 &above,
const v3s16 &real_under, const v3f &point, const v3s16 &normal,
f32 distSq);
u16 box_id, f32 distSq);
//! Constructor for POINTEDTHING_OBJECT
PointedThing(s16 id, const v3f &point, const v3s16 &normal, f32 distSq);
std::string dump() const;