I have been working on an RTS, i have a good camera script which handles keyboard input and have even got zoom that i like i have now turned my attention to building placement and have run into some problems…
i have made a script that can place objects onto a terrain model, and stops any half values, (ie 1 instead of 1.342) but i cannot find a way to stop blender putting 2 building under the same spot, the other similar thing, i cant figure out how to stop my script building on a stupid hill or on a river (ie an illegal place) etc
hmmm… without downloading your .blend (Time Crunch) are you placing the building using ray’s? I think A simple Distance check of the ray position, then loop through any building objects in the scene, and see if they are close enough. Then for river just have a property which will trigger the ray sensor, and don’t allow it to be placed!
Store positions of impassable terrain, then check the position of the building’s ‘place to be’ against the list of impassable terrain. When you build a building you can also add that position to the list of impassable terrain.
i have been thinking of both of those methods, however.
LDS_Marine - this approach would work for a 1x1 building but what about a 2x2 etc
andrew-101 - i have can script all the things i would need but i dont know how to store the array so i dont have to calculate it whenever i try to place a building,
hum, for global arrays, if I understand your need here, you can create new attributes for GameLogic, which will be available elsewhere in the game such as: #initialization script
GameLogic.myImpassableObjects=
[list,my,impassable,objects,here]
…
#placement test script #check if it’s impassable
for i in GameLogic.myImpassableObjects:
i am going to try the global method in the morning, but just to show it is work in progress, here is an updated version of my camera script. also could people please post the logic % they receive in game.