Page MenuHomeFeedback Tracker

lineIntersectsWith not detecting infantry
Assigned, NormalPublic


lineIntersectsWith does not intersect with foot soliders, and instead carries on through them until the next object (if in range). {F18233}


Legacy ID
Steps To Reproduce

1.In editor, place a player

  1. Set initline:

nul = execVM "scanner.sqf";

  1. create script "scanner.sqf"

while {true} do
_sResults = objnull;
_wPos = screenToWorld [0.5,0.5];
_sResults = lineIntersectsWith [ATLtoASL positionCameraToWorld [0,0,0], ATLtoASL _wPos, player, objnull, true];
hint str _sResults;
sleep 0.1;

  1. Place some objects like cars, players, buildings etc
  1. Point at an infantryman, and you wont get any result. Point at anything else placed in the editor, you'll get a result.

Event Timeline

Radioman edited Steps To Reproduce. (Show Details)Mar 18 2013, 6:44 PM
Radioman edited Additional Information. (Show Details)
Radioman set Category to Scripting.
Radioman set Reproducibility to Always.
Radioman set Severity to Tweak.
Radioman set Resolution to Open.
Radioman set Legacy ID to 1185942198.May 7 2016, 12:53 PM
Radioman edited a custom field.

Reporter is correct, although this bug is also present in A2! Furthermore, to complicate matters, screenToWorld appears to be in the habit of returning a bunch of nonsense within A3 ATM.

Ed: By "a bunch of nonsense" I mean that when the given screen position being sampled by screenToWorld is above the terrain (ie., in the sky), screenToWorld often returns strange y-coordinates (height) which then feeds the lineIntersectsWith command a false end position (ie. in this case, not anywhere along the vector from camera to the centre screen position).

Thanks for confirmation.

Thank you for approving this. I can't wait to finally be able to ditch 'cursorTarget' from my scripts.

Radioman, if you're trying to return the object the player is looking at then screenToWorld is not a reliable solution. The problem is that screenToWorld fails to provide an accurate return on the height (y-axis) whenever it samples anything above terrain level (ie. sky). So, objects protruding above the landscape from the player's POV will often not return properly. Worse yet, there appears to be no other scripting command that allows for the calculation of either the player's or player character's POV pitch angle. The only script command that works in this regard is weaponDirection, but that comes with it's own problems. See: for further explanation and repro mission.

Waiting for a solution too.

Problem still present on 0.75.108717
Waiting for a solution too.

Yeah noticed this too, thought it was a "feature" :)

Tajin added a subscriber: Tajin.May 7 2016, 12:53 PM

Problem still persists.

Was trying to use this to determine if a soldiers weapon is aimed at another person (since "aimedAtTarget" is also 'bugged' as it works only for vehicles).

SaOk added a subscriber: SaOk.May 7 2016, 12:53 PM
SaOk added a comment.Apr 7 2015, 12:11 PM

Would be nice to see this included. Would use it e.g in dynamic location cinema to detect units arent blocking camera view. Making it currently in custom way but the result is less good.

R34P3R added a subscriber: R34P3R.May 7 2016, 12:53 PM

without unit detection this funktions are 50% useless

lineintersectsobjs also not returning any units

Does anyone have a workround for this issue ?

I found a way: create a fakeObject on the unit (attach it) and make it invisible with setObjectTexture

(do not use hideObject, it will not returned by lineintersectsobjs)

SaOk added a comment.Aug 9 2015, 4:01 PM

You can divide the vector distance to pieces and commint nearentites check for those points. Used that method succesfully in my dynamic cutscenes to make sure actors arent blocking camera view.

R34P3R added a comment.Aug 9 2015, 4:07 PM

This will not work.. because this will not detect wals/building so you can "see trought"

Why Bohemia....WHY!?

You can use lineIntersectsSurfaces instead, which can detect units

Thank you. Hopefully more people will see that now ;)