mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
fixed a bug that caused the object picking to be very inaccurate
This commit is contained in:
parent
4b81abdb17
commit
136413d29a
2 changed files with 3 additions and 2 deletions
|
@ -115,7 +115,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
float div = (y4 - y3) * (v2.x - v1.x) - (x4 - x3) * (v2.y - v1.y);
|
||||
|
||||
// Can this be tested?
|
||||
if((div > 0.000001f) || (div < -0.000001f))
|
||||
if(div != 0.0f)
|
||||
{
|
||||
// Calculate the intersection distance from the line
|
||||
u_line = ((x4 - x3) * (v1.y - y3) - (y4 - y3) * (v1.x - x3)) / div;
|
||||
|
|
|
@ -454,6 +454,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
VisualPickResult result = new VisualPickResult();
|
||||
Line2D ray2d = new Line2D(from, to);
|
||||
Vector3D delta = to - from;
|
||||
|
||||
// Setup no result
|
||||
result.geometry = null;
|
||||
|
@ -495,7 +496,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
float side = ld.SideOfLine(ray2d.v1);
|
||||
|
||||
// Calculate intersection point
|
||||
Vector3D intersect = from + to * u;
|
||||
Vector3D intersect = from + delta * u;
|
||||
|
||||
// We must add the sectors of both sides of the line
|
||||
// If we wouldn't, then aiming at a sector that is just within range
|
||||
|
|
Loading…
Reference in a new issue