This code is from the blender game kit 2.0 (sub racer) it is used to make the bullets faster then the sub. I get everything, except for a few unexplained additions that are not notated in the book for why they are there. I just know removing these parameters does not initiate the add object actuators. Here is the code, and I’ll explain what I need help with.
This script takes the velocity of the ship into account for firing the cannons
also uses instantAddObject to prevent 1 frame lag of the Add Object Actuator
cont = GameLogic.getCurrentController()
me = cont.getOwner()
fire = cont.getSensor(“Fire”)
g1 = cont.getActuator(“G1”)
g2 = cont.getActuator(“G2”)
ys = me.getLinearVelocity(1)
As I said, I get all of this except for a few parts of this, " ys = me.getLinearVelocity(1)" line. I know it assigns the velocitry of the ship to ys, which is later used to add to the initial force of the bullet, but when I find “getLinearVelocity()” it does not explain ‘(1)’ what that details I have no clue, it looks like it activates the call and starts at array point 1, but I don’t I understand this very much.
Anyone think they could break this down a bit more for me?