I made a prototype for a project of mine, and i’m willing to share it with you all.
It’s a RTS building placement system with pre requirements, rotatable buildings, collision checks… so the buildings can be any size you like (0.1x0.1 or 1000x1000 it won’t be a problem), an option to zoom/look around, and it’s very easy to add more buildings/pre requirements(only 2 steps (1. create building, 2. put it’s name into the script)).
I will not post an other version of this, i’ll provide you my working prototype to build your own game from.
rts_building placement.blend (3.19 MB)
Forgot to tell how to rotate the building in the script, so i place the controls here as well:
- use B key to open the build menu
- use scrollwheel to zoom in/out
- hold middle mouse button to adjust the view
- use Q key to rotate a building
- left click places the building
- right click removes the building while dragging it
- left or right click while build menu is open will remove the building you are dragging
- if you drag a building and open the build menu, then clicking on an other item/icon will change the building to the one clicked on.
How to give buttons it's own texture
- go to build menu scene
- go to layer 2
- remove the material from the building_slot
- copy that slot 14 times
- give every slot it’s own material/texture
- give every slot the same name as the building/unit it represents ending with .ico, so ‘command center.ico’ or ‘powerplant.ico’
- now open the script and replace line 269 with:
building_icon = icon + '.ico' slot = scene.addObject(building_icon, own, 0)
Have fun with it,