Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional setting to disable laser pointer system #1589

Merged
merged 2 commits into from
Jun 13, 2015

Conversation

PabstMirror
Copy link
Contributor

Adds an ACE_setting to control the laser pointer feature.

A lot of times we're not using the feature, and it does have some cost:
On each frame ace_laserpointer_onDraw_counter: Average: 0.460449s / 1953 = 0.235765ms

If system isn't enabled, we never call onDraw or add the nearUnits PFEH..
If users starts with a "laser" attachement the keybind will still allow them to switch back to a "IR" pointer.

@PabstMirror PabstMirror added the kind/enhancement Release Notes: **IMPROVED:** label Jun 12, 2015
@nicolasbadano
Copy link
Contributor

Nice

@ulteq
Copy link
Contributor

ulteq commented Jun 13, 2015

Can't we use nearEntities instead of nearestObjects?

_nearUnits = (positionCameraToWorld [0,0,0]) nearEntities ["Man", 50];
if (count _nearUnits < 10) then {
    {
        _nearUnits append crew _x;

        if (count _nearUnits > 10) exitWith {
            _nearUnits resize 10;
        };

    } forEach ((positionCameraToWorld [0,0,0]) nearEntities ["AllVehicles", 50]);
} else {
    _nearUnits resize 10;
};

This runs a lot faster for me.

@kymckay
Copy link
Member

kymckay commented Jun 13, 2015

Pretty sure you can use nearEntities, the command is known to be faster 👍

Also, instead of checking if the array gets bigger than 10 and then resizing it back to 10, can't you just check if it's 10 and then exitWith?

Nevermind, I see why it's done that way now.

Conflicts:
	addons/laserpointer/XEH_postInit.sqf
@PabstMirror
Copy link
Contributor Author

nearestObjects sorts by distance, so the results wouldn't be exactly the same.

@ulteq
Copy link
Contributor

ulteq commented Jun 13, 2015

We can easily sort the nearEntities array with the new sort command. It would probably still be much faster. I did the same in the HuntIR module.

Reference: https://github.com/acemod/ACE3/blob/master/addons/huntir/functions/fnc_cam.sqf#L57-L64

We should benchmark it.

@thojkooi thojkooi added this to the 3.1.0 milestone Jun 13, 2015
PabstMirror added a commit that referenced this pull request Jun 13, 2015
Optional setting to disable laser pointer system
@PabstMirror PabstMirror merged commit f68a231 into master Jun 13, 2015
@thojkooi thojkooi deleted the laserPointerSetting branch June 13, 2015 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants