Is there an easy way to get the map location such as L20 from the HitInfo object? The HitInfo.HitPositionWorld returns a vector3 which is an xyz. I'm looking for something more simple like L20.
Finding HitInfo map location?
Discussion in 'Rust Development' started by AppetiteForDistruction, Mar 19, 2018.
-
Wulf Community Admin
What is L20 supposed to be? The game has no concept of a grid in that sense, it is an xyz vector system. If you want to have it translate to a grid, that's something you'd have to convert and handle via a plugin.
-
L20 would be the location on the game map. Do you know if anyone has already done this in a plugin? If I can copy someone else's code it would save me some time.
-
You'll probably have to write something yourself, but you can use the built in WorldSpaceGrid to take care of some of the more menial code. Initialize it with a cell size of 150 and that should divide the map up into 150x150m parcels (which is what the map uses I think). Make it a WorldSpaceGrid<string> and you can loop through locations, calculate coordinates, and assign the string coordinate location ("L20") to a particular grid cell. It also has included methods for getting the grid value at a specific Vector2, Vector3, or [x,z] grid coordinate.
Edit: FYI, you can look at ColliderGrid for more usage details. -
okay where is WorldSpaceGrid and ColliderGrid?