Dev Blog
Hi, this is the Stranded III development blog (see also Forum Thread, Comment Thread).
Entry 111 - Building Placement & Hold-Keys - February 5, 2023
Building Placement/Snapping
The building placement & snapping system is now implemented and working. It currently supports 4 modes:
free: The default. Allows to freely place stuff on the ground with any rotation along the Y-axis. Used for stuff like campfires and storages.
grid: Stuff is placed in a grid with a specific size. The grid orientation and origin is based on the closest building with the same mode so stuff snaps to the matching grid automatically. If no building is nearby you can place and rotate stuff freely. This is for building parts like walls, floors, roofs etc.
two points: You define start and end points for buildings. Nearby points snap together. These buildings can scale to some extent to perfectly fill gaps when snapping. This is mainly for fences and defensive walls. It may also be used for water pipes or tracks if I decide to add something like that.
mounted: Stuff snaps to nearby buildings with a defined logic. E.g. pictures which can only be put on walls etc.
There are various parameters to control the behavior in detail. Moreover it's possible to add extra placement logic and restrictions with Lua.
The same snapping logic is also active by default in the editor when placing buildings / building parts. It can be disabled though.
This gif shows the grid mode which allows to place stuff really quickly and easily. In most cases the building parts even rotate automatically as intended because rotation is coupled with the direction in which you're looking. So all I had to do to build this simple structure is moving around, looking around and clicking. I didn't rotate anything manually.
Hold-Keys
Stranded III now supports keys which need to be held down for a moment (a second) to trigger an action. This is a very common input pattern in games. It has (at least) two cool advantages:
It makes it harder to trigger critical actions by accident
It allows to offer 2x the amount of actions with the same amount of keys (as each key can have a press and a hold action)
The first action I used this for is destroying building sites and buildings.
Transform Gizmos²
I now fully replaced my "own" implementation of transform handles with the great solution by Peter @sHTiF Stefcek (https://github.com/pshtif/RuntimeTransformHandle.)
That's because my own implementation had less features and also some issues and limitations. I had to adjust/extend a few things but now you're also able - for instance - to move objects along 3 or 2 axes at once which can be quite useful. Moreover I can now easily use these handles for everything in the editor and not just entity placement.
The building placement & snapping system is now implemented and working. It currently supports 4 modes:
free: The default. Allows to freely place stuff on the ground with any rotation along the Y-axis. Used for stuff like campfires and storages.
grid: Stuff is placed in a grid with a specific size. The grid orientation and origin is based on the closest building with the same mode so stuff snaps to the matching grid automatically. If no building is nearby you can place and rotate stuff freely. This is for building parts like walls, floors, roofs etc.
two points: You define start and end points for buildings. Nearby points snap together. These buildings can scale to some extent to perfectly fill gaps when snapping. This is mainly for fences and defensive walls. It may also be used for water pipes or tracks if I decide to add something like that.
mounted: Stuff snaps to nearby buildings with a defined logic. E.g. pictures which can only be put on walls etc.
There are various parameters to control the behavior in detail. Moreover it's possible to add extra placement logic and restrictions with Lua.
The same snapping logic is also active by default in the editor when placing buildings / building parts. It can be disabled though.
This gif shows the grid mode which allows to place stuff really quickly and easily. In most cases the building parts even rotate automatically as intended because rotation is coupled with the direction in which you're looking. So all I had to do to build this simple structure is moving around, looking around and clicking. I didn't rotate anything manually.
Hold-Keys
Stranded III now supports keys which need to be held down for a moment (a second) to trigger an action. This is a very common input pattern in games. It has (at least) two cool advantages:
It makes it harder to trigger critical actions by accident
It allows to offer 2x the amount of actions with the same amount of keys (as each key can have a press and a hold action)
The first action I used this for is destroying building sites and buildings.
Transform Gizmos²
I now fully replaced my "own" implementation of transform handles with the great solution by Peter @sHTiF Stefcek (https://github.com/pshtif/RuntimeTransformHandle.)
That's because my own implementation had less features and also some issues and limitations. I had to adjust/extend a few things but now you're also able - for instance - to move objects along 3 or 2 axes at once which can be quite useful. Moreover I can now easily use these handles for everything in the editor and not just entity placement.