Blender 2.5 GE isPositive():

Hi guys,

maybe a simple question, but, what has isPositive(): changed to in Blender 2.5 Game Engine. It’s really annoying.

Thanks,
Blinker

Its an attribute now, so just .positive.

if sensor.positive:

Hey Andrew-101? How to do, motion.setDLoc(0.0, 0.0, turn, 1)

AttributeError: ‘KX_ObjectActuator’ object has no attribute ‘setDLoc’

Thanks will try and remember that.

Blinker.

motion.useLocalDLoc = True
motion.dLoc = [x,y,z]

Bookmark the docs, they will be the most helpful resource to you:
http://www.blender.org/documentation/250PythonDoc/

omg thank you!!!

Hey Andrew,

Should this work in 2.5.

import GameLogic

cont = GameLogic.getCurrentController()
own = cont.owner

#sensors

move = cont.sensors["move"]

#actuators

motion = cont.actuators["motion"]

#process

speed = 0

if move.positive:
    speed = 0.10

motion.useLocalDLoc = True
motion.dLoc = [speed, 0.0, 0.0]

That should work fine, just remember to activate the actuator.

Perhaps its better to use this: ?

import GameLogic

cont = GameLogic.getCurrentController()
own = cont.owner

#sensors

move = cont.sensors["move"]

#actuators

motion = cont.actuators["motion"]

#process

motion.useLocalDLoc = True
motion.dLoc = [0.10, 0.0, 0.0]

if move.positive:
    cont.activate(motion)
else:
    cont.deactivate(motion)