Page MenuHomeFeedback Tracker

lineIntersects does not return an intersection if underwater
New, WishlistPublic

Description

LineIntersects will not return a valid intersection if the ray path is broken by water. (startPos or endPos are underwater).

Please fix or provide alternative.

Details

Legacy ID
314120147
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Run this little script. It fires a lineIntersects underwater from a point in open water, through a pier object (on Altis)

_eyePos = [15514.2,15782.3,-6.1243];
_worldPosASL = [15515.6,15772.4,-8.97415];
diag_log format ["EYE POS: %1",_eyePos];
diag_log format ["WORLD POS ASL: %1",_worldPosASL];

_helper = createVehicle ["Sign_Sphere25cm_F",[0,0,0],[],0,"CAN_COLLIDE"];
_helper setPosASL _eyePos;
_helper setObjectTexture [0,"#(argb,8,8,3)color(1,0,0,1)"];

_helper = createVehicle ["Sign_Sphere25cm_F",[0,0,0],[],0,"CAN_COLLIDE"];
_helper setPosASL _worldPosASL;
_helper setObjectTexture [0,"#(argb,8,8,3)color(1,0,1,1)"];
_intersect = lineIntersects [_eyePos,_worldPosASL];
diag_log format ["INTERSECT ?: %1",_intersect];

If you change the z values to a position above the waves, then intersect is returned as true (as expected).

For example:

"EYE POS: [15514.2,15782.3,2]"
"WORLD POS ASL: [15515.6,15772.4,2]"
"INTERSECT ?: true"

In the above example, the object in the way is: 6da16b00# 541923: pier_box_f.p3d

Additional Information

Event Timeline

DasAttorney edited Additional Information. (Show Details)
DasAttorney set Category to Scripting.
DasAttorney set Reproducibility to Always.
DasAttorney set Severity to None.
DasAttorney set Resolution to Open.
DasAttorney set Legacy ID to 314120147.May 7 2016, 7:42 PM