Snapping Updates

ASE Snapping

We do a line trace along the player’s view out to the PlacementMaxRange (or at the point the trace is blocked) then do a sphere trace & all the structures caught in that sphere trace are evaluated for snap points. This has some downsides though, one being that you have to use a  short PlacementMaxRange or the initial trace will be too far away for a reasonable SnapCheckOverlapRadius to hit any structures:

The other problem though is due to how ASE sorts its snap points.

Snap points are sorted based on their distance from the end of the line trace. So in the picture above, A is closer to P (where the line trace ended) that is why it is the first snap point (B would be a cycle option). In this case, the sorting is intuitive since looking at the ground gives you a reference point but when the line trace ends at an arbitrary point in space it becomes much less intuitive to know where to aim to get the snap you want especially since PlacementMaxRange varies between structures so it is hard to get a feel for the sweet spot.

This is also why a large SnapCheckOverlapRadius is not ideal since there will be many more structures hit, which adds more snap points that you have to cycle through.

ASA Snapping

We still do a line trace initially and if that fails to hit anything then we perform a series of sphere traces from the player to the end of the initial trace.

Single Structure Snap Points

Unlike ASE where all nearby structures have their snap points added to the list, in ASA, you only get the closest structure’s snap points. This means instead of hunting for one snap point out of many, you simply need to get any snap point on the structure you want to snap to and then you can cycle through snap points on just that structure.

Remember though that ‘closest’ is still fairly arbitrary since it determines close by distance from the trace end which are the centers of the spheres (eg if multiple structures are hit on sphere trace 3, then they will be evaluated based on their distance from the center of sphere 3).

View Priority

When the player isn’t looking directly at a structure, it is fairly difficult to determine where their intended placement location is (ie do they want to place on the foundation in front of them, the one behind that or the one 4 away) but when they are looking at a structure we can be much more precise.

If the initial line trace hits a structure, then none of the sphere traces are performed and the player is only given snap points for that initial hit structure. Additionally, we use the spot they hit on the structure to further sort snap points by their distance to that hit, so that if you are looking at the left side then snap points on the left side are given higher priority than the snap points on the right side.

Here is an example of difference between relying on the sphere traces (looking where you want to place) vs looking where you want to attach:

In the picture above, the view trace isn’t hitting anything so the sphere traces start and the first sphere trace hits the foundation directly in front of the player. Now if they are outside placing this wall that would be desired but if they want to snap to the wall behind, it is better to look directly at the wall like this:

There are many structures in ASA that benefit from where you are looking at them in order to reduce the need to cycle snap points. For example, sloped walls place as the ‘right’ version when looking at the right side of the top of a wall and as the ‘left’ version when looking at the left side of the top of a wall.