Hello everybody (I’m a newbie to Blender)
I began with a very simple simulation : a ball first fall on a plan (x,y) and when I hit a key it gives an initial velocity (z,x) to it and I can see the ball making his parabolic trajectory.
I did this with the logic bricks and it works perfectly (motion actuator with linV=(10,0,10))
Now I want to do the same thing with a python controller and I have my kb sensor and my motion actuator attached to it.
Here’s the script attached to the controller :
cont=GameLogic.getCurrentController() own=cont.getOwner() #sensors go= cont.getSensor("go") #actuators motion=cont.getActuator("motion") if go.isPositive(): motion.setLinearVelocity(10,0,10,1) print "set initial velocity" GameLogic.addActiveActuator(motion,1) print "end script"
When I do this it looks like the ball keeps the initial velocity and is not affected by the gravitaional field (or like if the velocity is always set back to the initial velocity)
I’ve search for the methods of the motion actuator in the api but just found the KX_Object actuator.
Is this the method I should use to have the same thing as linV in my logic brick ?
Or I’m missing something ?