2

This code currently allows for buildings to be placed on flat surfaces (using an object as the Collision Detector). It works fine for that, but how could I make it so that it can only be placed on one object like the plane (the ground of the map). The reason for this is that right now you can place buildings on top of other buildings. My map is flat so does not have any bumps or hills so I don't really need it nor want it to be placed on any flat surface. Thanks!

from bge import logic

def main():
scene = logic.getCurrentScene()
cont = logic.getCurrentController()

mouse_over = cont.sensors["MouseOver"]

if mouse_over.positive and scene.objects["Arrow"]['ActiveYesNo?'] :
tracker = scene.objects["Arrow"]
tracker.worldPosition = mouse_over.hitPosition
tracker.worldPosition.z += 1
hehehehahha
  • 143
  • 3

0 Answers0