Control the linV of AddObject Actuator

Hi all. As the title suggests I am trying to control the linear velocity of the Edit Object/ Add Object actuator.

So instead of setting once as a constant, I was trying to write a py script to have a game property be the (y) value. So:

cont = GameLogic.getCurrentController()

spawn = cont.actuators[“Spawn”]

spawn.linearVelocity = [ (“prop”), 0.0, 0.0]

Now that’s the logic, but taking the property (prop) out of the equation to simplify things, I still cant manage to set the linear velocity?

Any help would be much appreciated. :spin:

To get the value of a property use this:

 
cont.owner["prop"]

the result would be:


spawn.linearVelocity = [cont.owner["prop"],0.0,0.0]

For Y use:


spawn.linearVelocity = [0.0, cont.owner["propY"],0.0]

I hope it helps

Awesome. Thank you so much Mr. Monster :slight_smile: