bge python if statements getLinearVelocity
Question: Im new to scripting and programming in general, but I have a decent handle on
the concepts, however, I need a little help and I am not sure I'm even
searching and googling the right terms for what I want to do. I need help with
what I would imagine is a simple if statement in the Blender Game engine 2.71.
what I need to do is to get an objects linear velocity in global terms and
then check it to see if it is equal to 0 on all vectors, then I wish to add
some linear velocity in xyz.

this is what I have but ofcouse it doesnt work: (please dont hate, Im
hella-n00b)

    
    
    import bge
    from bge import logic
    
    scene = logic.getCurrentScene()
    
    cube = logic.getCurrentController().owner
    speed = cube.getLinearVelocity()
    
    if all(speed == 0):
        cube.setLinearVelocity([0, 0, 10], False)
    


Answer: Since you're only checking for the case when the velocity is zero, you could
use:

    
    
    if sum(speed) == 0:
        cube.setLinearVelocity([0, 0, 10], False)
    

where `sum()` is the built-in python function for summing the values in a
`list`.

