Hello there! I’m attempting to develop a script that checks the altitude of all objects in the scene, and if the altitude of an object is “sea level”, it’ll add a force to it multiplied by a few custom properties of the object in question. I haven’t coded the altitude check yet, as I’m having a rather serious problem with the code already. That is, the applyForce code isn’t working… Without it, the script works fine.
import GameLogic from bge import logic scene = logic.getCurrentScene() cont = GameLogic.getCurrentController() own = cont.owner activate = cont.sensors["activate"] if activate.positive: own['WORKING'] = 1.0 #just a pre-check to see if the code's working. for target in scene.objects: if "FloatAmount" in target: target.applyForce([0.0, 0.0, target['FloatAmount'] * own['force']], False) # ^ here's the problem... This line simply doesn't work. Both the properties ('FloatAmount' and 'force') are accounted for. I can't seem to find a solution... target['FLOATING'] = 1.0 #just another check to see if the code's working.
Yep. If I could get a solution to this, it would be greatly appreciated. Thanks!