Page MenuHomeFeedback Tracker

Add "cursorToWorld" command
Assigned, WishlistPublic

Description

This command, let's assume for now it would be called cursorToWorld or something named more appropriately, would return the world position where your cursor is pointing.

Currently the closest analogues to this would be:

  • "cursorTarget" which only returns the object reference the cursor is on
  • "screenToWorld [0,0]" which returns positions on the terrain and does not account for objects

The command would return 3D world coordinates of the location where the cursor is intersecting either geometry, terrain or skybox. Whichever comes first.

Potential expansions to the command would be the ability to ignore objects and only intersect with terrain or to choose different LODs of objects to take into account.

Details

Legacy ID
1595012446
Severity
None
Resolution
Open
Reproducibility
Always
Category
Feature Request
Additional Information

Usage would be something like:

_ctw = cursorToWorld [<string collideWithLODs>, <array ignoreObjects>];

Where collideWithLODs would have options like:
"NONE" (would ignore objects), "GEOMETRY", "VIEW_GEOMETRY", "FIRE_GEOMETRY", etc.

And ignoreObjects would accept an array which the ray that was cast to the cursors position would ignore and pretend like they weren't there at all.

Some example pictures.

http://i.imgur.com/gK98YTO.jpg
http://i.imgur.com/j6lh6I0.jpg
http://i.imgur.com/iAnx2Ef.jpg
http://i.imgur.com/Z60PUaO.jpg

Event Timeline

Sniperwolf572 edited Additional Information. (Show Details)
Sniperwolf572 set Category to Feature Request.
Sniperwolf572 set Reproducibility to Always.
Sniperwolf572 set Severity to None.
Sniperwolf572 set Resolution to Open.
Sniperwolf572 set Legacy ID to 1595012446.May 7 2016, 3:44 PM

whats the problem with using 2 commands, screentoworld and lineIntersectsWith?

  • screenToWorld always returns the world position at ground level, therefore it cannot be an accurate representation of the current cursor position
  • lineIntersectsWith only returns the object reference
  • You can't assume the cursor is in the center of the screen, so some additional code would be required to track the cursor position on the screen
  • Combining screenToWorld and lineIntersectsWith would result in a poor man's cursorTarget which is already available in the game instead
  • The return value proposed by the command would be actual world coordinates at what the cursor is pointing, as you can see in the screenshots demonstrated
  • None of the intersect commands return the world or model coordinates at which the intersection occurs

I don't think you can have exact position either, mainly because this command will be very expensive, especially when pointing at irregular shaped object. This means it somehow will have to scan the shape of the object in order to determine exact position ATL. Yeah, if there is command like this, bring it on!

Another problem is what happens if I point above the ground and there is clear horizon on the other end, what coordinates it should return? If it meant to return intersect object then it is easy, objNull will be the return or object if there is one. I guess in case of position it should return []?

No more intensive than shooting your rifle.

"intersect" (https://community.bistudio.com/wiki/intersect) command already does intersection based on LODs between two points, it returns the named selection on the model which it's intersecting (currently I could only get it to work on the "FIRE" LOD).
In addition to the named selection, it also returns the distance along the line at which it intersects. This allows for a simple calculation of the position at which the intersect point happens because we know the current point in space where the line starts, it's end point and as such we can calculate the vector of the line. Since we were just returned the distance on that line, we can do another quick calculation from the starting point with the previous vector normalized then extended the distance we were given.

Unfortunately "intersect" doesn't work for all LODs and not all named selections will be returned in the given LODs.

As for the clear horizon, I've accounted for that in the ticket, since the skybox is a huge sphere around the player, it should be the last object checked for intersection and if it reaches it, then the coordinates of the intersection with the skybox would be returned so we have a meaningful height. Since this might be overdoing it, returning null would also be ok if horizon is reached.

Currently there are scopes in the game which calculate the precise distance including the geometry calculations and the laser designator has been doing the similar raycast forever now. The same raycast also happens when you command the AI.

just tried intersect and it works with all 4 LODs view fire ifire and geom. For player model works only with fire and ifire

Yep, I stand corrected, just tried it again myself. For some reason GEOM never returned anything where FIRE did when I tested it last time. Unfortunately it doesn't return the geometry components, just some certain selections.

Just stumbled upon this wonderful command "laserTarget", it returns laser target with coordinates of the laser dot on a surface, which is essentially what you are asking for. The only setback you have to have laserdesignator with batteries. I think it should be very easy for BIS dev to copy paste this into a workable function.

Yep. A slightly more advanced, laser-less laserTarget. :)

Great suggestion, would very like to see it implemented.

PiepMGI added a subscriber: PiepMGI.May 7 2016, 3:44 PM

My question should be : how get the same distance info as displayed in the range finder ?

  • one meter to my feet,
  • 3, 6 ,1000 , 2000 or whatever to the green grass aimed spot,
  • continuous distance along a wall,
  • whatever object distance,
  • nothing at empty skies.

Seems to be so hard!

It seems there is no answer to add a simple "check any distance" to cursor (or aimed point). What is the magic equation for distances in a rangeFinder?

See also video at: http://feedback.arma3.com/view.php?id=23023
Playing out of group, player has no "knowsAbout", no "cursortarget" on enemies

Question apart, "solved" by auto report enabled in game difficulty.

Any news about this question: how get the same distance info as displayed in the range finder ?
How the problem is "reviewed"? Could you assign it and work on it , please?

SaOk added a subscriber: SaOk.May 7 2016, 3:44 PM
SaOk added a comment.Apr 14 2015, 10:15 PM

Would need this command too in my construction system.

oh, oh, this ticket was "chose"-n by dwarden, could only mean a good thing ;)

I'd also suggest to introduce cursorToScreen along with cursorToWorld to return position of the cursor in UI screen coordinates

dedmen added a subscriber: dedmen.Sep 13 2017, 2:38 PM

screenToWorld + lineIntersects.

Cursor might not be in center of the screen